Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

A problem with UI layering.

Discussion in 'UGUI & TextMesh Pro' started by DBether, Mar 2, 2016.

  1. DBether

    DBether

    Joined:
    Sep 18, 2015
    Posts:
    15
    Hello!

    I have a small problem. I've got an Inventory in which you can pick items from the inventory slots and place them inside of other free slots. Of course I'd like the item icon (when picked up) to be following the mouse and be displayed above all of the slots but unfortunately I can't do that. If I place the "Cursor Image" object at the bottom of the Inventory hierarchy it gets rendered on top of everything else but that prevents the Event Trigger object that's placed on all of the slots from detecting a "Pointer Click" event that is supposed to place the item inside of that slot.

    Here's a video as an explanation of my problem.



    P.S. The object "Cursor Image" is just a UI Image that follows the mouse cursor and get's activated and assigned the item icon as a sprite when an item is picked up.
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @DBether - I think you better check Unity UI examples, IIRC it had a solution for this.
     
  3. phil-Unity

    phil-Unity

    Unity UI Lead Developer Unity Technologies

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Simply turn off the raycast target on the cursor image component.
     
  4. DBether

    DBether

    Joined:
    Sep 18, 2015
    Posts:
    15
    Thank you, it works. :)