0
\$\begingroup\$

My canvas buttons are behind the object. I don't want this to happen. Screen space overlay no problem, but when screen space camera does this.

\$\endgroup\$
1
0
\$\begingroup\$

ScreenSpace-Overlay

Rendering process:

Render GameObject1
Render GameObject2
Render GameObject3
...
Render Canvas

When using Screen Space overlay, first all GameObjects in the scene are rendered.The canvas is rendered last.

ScreenSpace-Camera

When using Screen Space Camera, that means the camera treats the canvas like Gameobjects. U can treat it like a plane in 3D world except it is always perpendicular to the camera view direction.

Rendering process:

Render GameObject1
Render GameObject2
Render Canvas
Render GameObject3

The rendering order is from far to near to the camera.

In your case, you can just Plane Distance of your canvas settings. Make it smaller, so it is nearer to your camera. Thus make it in front of other GameObjects.

\$\endgroup\$
3
  • \$\begingroup\$ It is using screens space though. The problem is likely Order Layer. Change the number from 0. \$\endgroup\$ – Sidar Jan 14 '19 at 18:54
  • \$\begingroup\$ thank you, but the overlay button is working but the screen space camera did not work when the button. What is the reason ? \$\endgroup\$ – Yusuf Yüzbaşıoğlu Jan 14 '19 at 20:39
  • \$\begingroup\$ @YusufYüzbaşıoğlu I edit my answer to give further explanations. If you have no other questions, please mark answer accepted. \$\endgroup\$ – AlexWei Jan 15 '19 at 2:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.