Author Topic: Obj with collider and event trigger needs sprite to receive click?  (Read 3378 times)

krubba1

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
I had 2 objects with colliders, say a character object that resides behind a screen sized clickable collider. In the editor the screen collider is clearly in front of the character collider, but the clicks would not register if you clicked it where the character collider was. All under same UIPanel.

Since screen collider is just that, a collider, it had no sprite associated with it or child'ed to it. What ended up fixing my issue is putting a sprite under it and setting the depth of sprite to higher than my depth of character sprite, and just setting colour to transparent. Now my clicks work.

Posting this in case someone else runs into this problem, but wondering if this is expected behaviour. Maybe something to do with using UIEventTrigger?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Obj with collider and event trigger needs sprite to receive click?
« Reply #1 on: May 14, 2015, 06:06:44 PM »
ALT+SHIFT+W creates an invisible widget. ALT+SHIFT+C adds a collider to it. Resize it to desired dimensions, adjust its depth.