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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

UI Mask and pointer events

Discussion in 'UGUI & TextMesh Pro' started by DoomSamurai, Dec 4, 2014.

  1. DoomSamurai

    DoomSamurai

    Joined:
    Oct 10, 2012
    Posts:
    159
    Hello,

    Is there a way to have a UI Mask clip a UI element and then ignore pointer events like clicks when the pointer is over part of the clipped mask ?

    In my case, I'd like to have a minimap that is round, and I'd like the EventSystem to ignore clicks that are done in the clipped area in the corners.

     
  2. smootler

    smootler

    Joined:
    Aug 3, 2014
    Posts:
    19
    This is answered in the FAQ here: http://forum.unity3d.com/threads/frequently-asked-ui-questions.264479/ under "How do I make UI elements have non-rectangular hitboxes?".

    One thing to note if you use the per-pixel hit detection in the linked script by senritsu, make sure the import settings on your sprite have Mesh Type set to "Full Rect", otherwise it wont work.
     
  3. DoomSamurai

    DoomSamurai

    Joined:
    Oct 10, 2012
    Posts:
    159
    Thank you very much, this is perfect! I somehow missed it when I browsed through the FAQ :S