I have many UIs that occupy the same space on the screen and are hidden and shown as the game requires. Each button contains a collider (set to trigger) for that button and mouse/touch interaction is done via Physics.Raycast(). The problem I have is that when I am trying to click certain buttons that are visible, the Physics.Raycast() returns the Collider for a button who’s GameObject is inactive. The UI is all in one hierarchy, the root of which contains a kinematic RigidBody with gravity off. If I remove this RigidBody, the ‘hidden’ colliders are no longer hit by the Raycast and it all works.
The docs are a little woolly on this - it says raycast is performed against all colliders (and presumably triggers) in the scene, and naturally there’s the option to rayacst only against certain layers. It isn’t explicit about behaviour against colliders on inactive GameObjects. I would however, have thought that the raycast would remain the same regardless of the RigidBody, unless the RigidBody has some intentional side-effect I am unaware of?
So what should the behaiour be? If the RigidBody is altering the behaviour, is this as expected? If so, can someone explain it, if not, can you post the link to log a bug :oD
I am using nGUI and have sought some guidance on the nGUI forums, but this feels more like a Unity issue? I am on the latest (3.6.6) Unity (Pro) and the latest nGUI. I have tried to re-create the issue in a smaller scene with no success as yet.
Thanks in advance.