Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: omskillet on November 27, 2013, 11:43:42 PM

Title: Issue with Prefab'ing a 2D UI
Post by: omskillet on November 27, 2013, 11:43:42 PM
Whenever I create a prefab of a 2D UI setup and then add it back to a new scene with a player in it ( a la a pause menu ) the UI is no longer rendered in screen space. I can see it being rendered out in the world but it doesn't follow the player. If I create one from the NGUI menu with the same scene everything works fine. Any ideas?

Also whenever I create a new 2D UI the layers always default to whatever is in layer 8. Is that the desired behavior?
Title: Re: Issue with Prefab'ing a 2D UI
Post by: Quarkism on November 28, 2013, 12:02:22 AM
Try checking the layers. Including parents. I noticed this happens when I have a container object in the default layer.
Title: Re: Issue with Prefab'ing a 2D UI
Post by: omskillet on November 28, 2013, 02:55:00 PM
I have the UI Root and all its children in a layer called GUI. The player camera is in a mixed layer. Not sure what I'm doing wrong here.

Test case for me:

1. In an empty scene create a simple 2D UI.
2. Add a basic sprite.
3. Rename the UI root to "TestPrefab"
4. Drag to Prefab folder.
5. Close the scene.
6. Open scene with my custom player controller.
7. Drag in the TestPrefab

Notice the GUI sits in the world and not on the player screen

If I repeat steps 1 and 2 in the scene with the player controller everything works as I expect.
Title: Re: Issue with Prefab'ing a 2D UI
Post by: ArenMook on November 28, 2013, 03:38:12 PM
Select your Main Camera and modify its Culling Mask so that it's not drawing your UI layer anymore.