Author Topic: How to listen click event which doesn't belong to current button  (Read 11101 times)

rob

  • Guest
Re: How to listen click event which doesn't belong to current button
« Reply #15 on: June 06, 2013, 09:03:18 PM »
Ah - so effectively flagging it as "used" when handled. I like that - thanks! :)

imperso

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: How to listen click event which doesn't belong to current button
« Reply #16 on: May 04, 2015, 03:05:21 AM »
Hi, Aren.
I'm making something like remote helper. We have two devices with the same app and layout. User A does something (clicks, drags, etc.), and app transmits his action to User B device.

To accomplish this I need to forward all user input events UICamera gets to the second device, what I'm going to do by passing events from the initial GameObject to corresponding GameObject on linked client.

So, I'm doing this:
  1. UICamera.genericEventHandler = this.gameObject; // <- my intercepting "hub"

The intercepting GameObject has UIEventTrigger script which triggers corresponding method for every event and retargets the event to the second client using UICamera.hoveredObject.name.

But as every of my receiving GameObject has its own event handler, I don't care what kind of event I intercept. I just pass it.
Is there a way I can just pass any event as a string variable without writing numerous methods covering each case (OnPress, OnClick, etc.)?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to listen click event which doesn't belong to current button
« Reply #17 on: May 05, 2015, 10:06:20 PM »
Yes. UICamera.onClick, UICamera.onPress, etc.