Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity UI Canvas not rendering when using Screen Space - Camera

Discussion in 'UGUI & TextMesh Pro' started by waffledork, Mar 25, 2018.

  1. waffledork

    waffledork

    Joined:
    Mar 25, 2018
    Posts:
    1
    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.)







     
  2. datagreed

    datagreed

    Joined:
    Sep 17, 2018
    Posts:
    42
    I am in the same boat here. Have you found a solution?
     
  3. St_Saccharine

    St_Saccharine

    Joined:
    Oct 24, 2019
    Posts:
    1
    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.
     
    Tp33, BjoUnity3d and prashantshah like this.
  4. raghav15102004

    raghav15102004

    Joined:
    Aug 5, 2018
    Posts:
    1
    thanks buddy:)
     
  5. MindGem

    MindGem

    Joined:
    May 11, 2017
    Posts:
    84
    What if I need to have Screen Space - Overlay on my Canvas. Can I still make some changes to make Instanciated things show up?
     
  6. LaserJaguar

    LaserJaguar

    Joined:
    Mar 5, 2014
    Posts:
    2
    Also if you have multiple cameras with some of them using Clear Flags - Depth only - make sure to set their depths in correct order.