Author Topic: Event forwarding  (Read 2116 times)

Maxii

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 55
    • View Profile
    • Strategic Forge
Event forwarding
« on: August 29, 2013, 04:48:09 PM »
I'm struggling with how to forward events to their targeted game object from a FallthruEventHandler attached to my main 3D UICamera. I've successfully implemented the handler that gives me a copy of all UICamera events except those that go to my Gui layer (handled by a separate 2D UICamera on that layer). The main UICamera's EventReceiverMask is set to nothing like you did in Windward. I can see them arriving just like you said. What I can't figure out is which game objects they should be forwarded too and how to do it. UICamera.hoveredObject always points to the FallthruEventHandler which makes sense as there never was a hit on a gameObject collider, due to the eventMask. Without a hit on the game object being recorded in hoveredObject, how do you know who you were attempting to talk too?

I expect the answer will cause me to be :-[, but I'm at the point where I have to ask. What am I missing?
I'm looking for an artist partner to complement my programming skill in developing a space-based Civilization-like empire building game, ala GalCiv2 or Distant Worlds based on Unity3D.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Event forwarding
« Reply #1 on: August 29, 2013, 05:00:55 PM »
At this point you should do your own logic to determine what you're trying to interact with -- for example by doing a new Raycast. Generally though, fallthrough means the event was not handled by anything. It lets you react to "clicks on nothing". You can set up your game camera with a UICamera as well, and this will let you interact with all colliders, not just those handled by the UI. It's really up to how you want to do your game interaction.

Maxii

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 55
    • View Profile
    • Strategic Forge
Re: Event forwarding
« Reply #2 on: August 30, 2013, 10:12:09 AM »
Thanks! I can see my way forward now that I know I wasn't missing something obvious.  :)
I'm looking for an artist partner to complement my programming skill in developing a space-based Civilization-like empire building game, ala GalCiv2 or Distant Worlds based on Unity3D.