Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Exclude UI object from UI Event System?

Discussion in 'UGUI & TextMesh Pro' started by Dam-Pete, Nov 26, 2014.

  1. Dam-Pete

    Dam-Pete

    Joined:
    Jun 11, 2010
    Posts:
    54
    Hi,

    I've been using the UI for a while, I'm pretty sure I have a grasp on how the Z-Ordering works, the only problem is sometimes I want to have an overlay, but any buttons that are behind don't receive the events. There are 2 cases where I have found this to be a problem:

    1. In my game the user has to interact with an emulated LCD Touch Screen. So I have the frame around it and a few buttons in the middle. The frame is a single sliced image and I placed it over a green backdrop. I can't get the buttons to be able to be interacted with this way, I need the frame to actually be rendered behind my "screen". It makes no difference if I choose Fill Center or not.

    2. I have a sprite that simulates my mouse cursor (this is for UI interaction using Kinect, it's not simply cursor aesthetic, which I know can be changed via settings). This sprite is an Image, however when I'm testing with my mouse I cannot send clicks to my buttons because this Image is being rendered over them.

    So basically I'd like to know if anyone knows how I can exclude an object from the UI Event System...
     
  2. Dam-Pete

    Dam-Pete

    Joined:
    Jun 11, 2010
    Posts:
    54
    Managed to figure it out. If anyone else encounters this problem, here's how I solved it:

    Place a Canvas Group on whichever object you wish to exclude. Then uncheck Blocks Raycasts (and probably Interactable as well).
     
  3. Fluzing

    Fluzing

    Joined:
    Apr 5, 2013
    Posts:
    815
    This helped me. Wish there was an easier way though.