Author Topic: Can you sanity check my plan to integrate NGUI?  (Read 1859 times)

calbar

  • Guest
Can you sanity check my plan to integrate NGUI?
« on: October 16, 2013, 08:22:08 PM »
I wanted to get an expert opinion on my high-level approach to NGUIfying my game. It's top-down with drag, pinch, and rotate camera controls, selectable 2D UI elements, and selectable 3D objects in the environment.

So here was my plan:
  • Create two cameras: a 2D ortho cam for my 2D UI and a 3D game cam with an additional UICamera script attached.
  • Set the depth of the 2D camera higher than that of the 3D camera so it processes input first.
    • If none of the 2D UI elements are hit, I presume the 3D UI will then check for collisions with GameObjects in my environment.
  • Set the event mask of the 3D UICamera to ignore terrain.
    • If none of the GameObjects in the environment are hit, and without terrain, I presume events will be sent to the 3D UICamera.fallThrough target.
  • Set the 3D UICamera.fallThrough to my GameObject that handles camera control gestures.
How does that sound?

Thanks!

calbar

  • Guest
Re: Can you sanity check my plan to integrate NGUI?
« Reply #1 on: October 18, 2013, 09:52:33 AM »
I'd still love to get some feedback on this approach before I proceed!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can you sanity check my plan to integrate NGUI?
« Reply #2 on: October 18, 2013, 04:35:00 PM »
FallThrough may not be the place for gestures. What if you start the gesture on a unit (many units on the screen)? GenericEventHandler may be the better way to go for gestures.

calbar

  • Guest
Re: Can you sanity check my plan to integrate NGUI?
« Reply #3 on: October 19, 2013, 07:14:36 PM »
Ah, good point. Now that I think about it, even if a GameObject doesn't respond to an event, it's still gonna intercept the raycast.

Alright, outside of that, I'll assume this approach sounds good. Thanks again man!