Support => NGUI 3 Support => Topic started by: Shifty Geezer on March 16, 2014, 04:39:35 PM
Title: NGUI camera hijacking my sprite!
Post by: Shifty Geezer on March 16, 2014, 04:39:35 PM
I have a quad, a normal-mapped balloon. It's drawn on screen using the (orthographic) game camera. If I add an NGUI UI (create UI, no content), the balloon is not drawn by the game camera and is drawn by NGUI's camera. Whether 2D or 3D, the quad is only drawn by the UI camera. This is with NGUI 3.0.9 and 3.5.3.
I am also unable to Ctrl-X cut the balloon object once NGUI UI is added. And removing NGUI, deleting the NGUI UI GameObject and the NGUI folder, the balloon remains drawn by the now-deleted NGUI camera.
How is that even possible??
Title: Re: NGUI camera hijacking my sprite!
Post by: ArenMook on March 17, 2014, 01:29:40 AM
What draws the balloon? NGUI won't have any effect on anything other than an NGUI widget. Check its layer as well. If you place your balloon on the same layer that NGUI uses, when NGUI creates its UI camera that camera will remove that layer from the main camera's culling mask.
Title: Re: NGUI camera hijacking my sprite!
Post by: Shifty Geezer on March 17, 2014, 04:16:05 AM
I don't know what draws the balloon. My game structure:
3D Game
_Balloon
_MainCamera (orthographic)
Level objects
NGUI UI
camera
When I add the NGUI UI, the balloon is drawn by the NGUI camera despite being in the 3D Game tree. If I delete the NGUI Camera, the balloon is not drawn despite appearing in the 3D Game tree. I had it once where the balloon remained, but that hasn't happened on the most recent tests.
Title: Re: NGUI camera hijacking my sprite!
Post by: ArenMook on March 17, 2014, 11:44:36 AM
Check the layer of the game object itself. It's the only thing that can possibly affect which camera it's drawn by. On the camera you can choose a culling mask which affects which layers the camera is able to "see".
Check Unity's documentation for the Camera class -- this is not an NGUI question.
Title: Re: NGUI camera hijacking my sprite!
Post by: Shifty Geezer on March 17, 2014, 05:51:52 PM
That's it. I guess NGUI uses 'user layer 8' by default and where I was using that for a physics layer for my balloon, that also shifted it into NGUI's layer. Changing layer fixed it. Thanks.