Author Topic: Best way to pass an OnClick event on to objects behind the top one?  (Read 3016 times)

Artrageous

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
What is the best way to pass an OnClick event on to objects behind the top object?
I have a button, with a Box collider, that gets OnClick() events. I have my own OnClick routine  to handle these. This works fine.
I want the parent object the button is on to also get the OnClick event when I click the button.
This parent object is a sprite, it is the parent of the button in the object hierarchy, and behind it in the scene.
What is the best way to do this?
I could get a  reference to the parent object, store it in the button, and call the it's routines in the button OnClick , but this seems a bit unwieldy.

Thanks

Artrageous

PS
Have the feeling that this is a stupid question, and I am missing something obvious!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best way to pass an OnClick event on to objects behind the top one?
« Reply #1 on: September 29, 2014, 07:16:04 AM »
UIEventTrigger or UIForwardEvents.

Artrageous

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Best way to pass an OnClick event on to objects behind the top one?
« Reply #2 on: September 30, 2014, 08:51:54 PM »
Thank you.
I knew it had to be something simple.

Artrageous