- Home /
unity GUI: Place a prefab in front of another one
Hi experts, I made 2 prefabs: A, B. I want A to be in front of B. however no matter how I change the hierarchy, B is always in front of A in the game window.
Any idea how I can resolve this?
Any input is greatly appreciated! Thank you!
In front in the game window... you mean as in closer to the camera? Have you tried moving one of them in Z axis? I'm guessing you're a newbie and are using 2D mode, in that case look for a button that says 2D over your game window, to the left of the activate/desactivate lights button, this way you can see the world in 3D and easily move around objects in z view.
Thanks for the reply Eirikra, I am really new to Unity. I tried to move them in Z axis,in the scene window I can see that A is above B, but in game window nothing changed. any thoughts?
The order that the objects are in the outliner doesn't matter, they're not layers like in Photoshop, they're just listed there as in any other 3D software; it doesn't matter if they're above or under each other in there but their position in the world. If you want to put something above other stuff in the game screen you should move them in the Y axis, if you want to put something infront then Z axis, that's it. If putting A on (0,0,1) and B on (0,0,0) still shows B in front of A and your camera is in positive Z then I have no idea what's going on o.O would you $$anonymous$$d illustrating (screenshot)?
Your answer
Follow this Question
Related Questions
Any way to change the default canvas parent when opening UI prefabs in the new Prefab editor. 1 Answer
Is there a way to sort UI elements overriding the hierarchy? 0 Answers
Line from Parent to Children on UI 0 Answers
Problems assigning sprite's images 1 Answer
SetActive true not working on UI object 2 Answers