Canvas not rendering when using Screen Space - Camera

I’m new to Unity, have been working my way through a few tutorials, and decided to try my hand at making a Slitherlink game and I’m running into trouble with the canvas.

When I have Screen Space - Overlay, the canvas renders and the lines are in the right spot but because the canvas renders on top of everything else, the lines don’t appear. To get around that, I’m attempting to use Screen Space - Camera and am having very little success.

Looking at it from a 3D perspective, I can see the lines showing up either in front or behind the canvas, depending on the z-value I assign the endpoints of the LineRenderer variable I’m using. What’s odd, however, is that the canvas doesn’t seem to be rendering at all, despite where the lines are located. You can see the dots and numbers in the Scene View but the canvas doesn’t seem to appear at all in the Game View.

I’m all out of ideas on what to try at this point – does anyone have any suggestions on how I can get this to work?

(Also, I’m not sure why my lines are pink instead of black when I have the following snippet in my code:

lr.startColor = Color.black;
lr.endColor = Color.black;

but that’s for another time.)

I am in the same boat here. Have you found a solution?

On the Canvas Object in question, go to the Canvas component and adjust ‘Plane distance’ until the canvas becomes visible. (Assuming you’re using orthographic Camera, Screen Space - Camera).

Most likely, your Orthographic Camera’s near and far planes are not in the range that the Canvas is placed at.

4 Likes

thanks buddy:)

What if I need to have Screen Space - Overlay on my Canvas. Can I still make some changes to make Instanciated things show up?

Also if you have multiple cameras with some of them using Clear Flags - Depth only - make sure to set their depths in correct order.