Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: calbar 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!
-
I'd still love to get some feedback on this approach before I proceed!
-
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.
-
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!