- Home /
GameObject on top of GUI Screen Space Overlay
i have gui on the bottom of my project which is using screen space overlay, and on this gui there are elements that i can click and drag to my map. but when i start to drag the element appears under the gui (which is what i expected) so i tried to position it on a different layer so it would be on top although it does not work, i also tried to create another camera and position it on top of the camera rendering the gui but since it is screen space overlay it makes it impossible. any suggestions ??
Answer by Kiwasi · Dec 13, 2014 at 02:49 AM
This is impossible to do in Screen Space - Overlay. As the name implies overlay goes on top of everything. It is rendered after the rest of the scene has been rendered. While this makes it cheaper to render, it also means you can't put anything in front of it.
The Fix is to use Screen Space - Camera. You can then adjust the plane distance to allow GameObjects to be in front or behind it. Depending on the distance from the camera.
Thanks for the info, i used Screen Space - Camera before but the problem i had was that the gui elements would jump while using pitch zoom as if it is re-sizing. Is this a problem with my script or is it normal?
Not sure. $$anonymous$$ost of my work has been in 2D games with fixed cameras. I did note some jittering of the UI when the camera was falling at high speeds in a proof of concept project, but the concept never got off ground, so I never fixed the problem.
oh too bad. Im also making a 2d game but now i stuck with how to solve this. Im dragging an element from the gui to the map and my ondrag event creates a clone which i would like to be on top of the gui when created but then later under the gui when the object is placed on the map.
This is very helpful. Would you say this is one of the more important reasons to pick Camera over the other?
Your answer
Follow this Question
Related Questions
Stop rendering scene when GUI window is active. 2 Answers
Disabled Camera acts strangely outside of editor (solved) 0 Answers
flickering lines when zooming fov (both GUI and ortho cameras). 2 Answers
New GUI - Text not rendering in front of geometry if using a Mask 1 Answer
FLYING from Camera Position A to B per Buttom click? 5 Answers