Search Unity

World space canvases sometimes appear behind further canvases.

Discussion in 'UGUI & TextMesh Pro' started by wx3labs, Sep 28, 2015.

  1. wx3labs

    wx3labs

    Joined:
    Apr 5, 2014
    Posts:
    77
    In the image below, there are five cards, each with a world canvas ui in them containing some sprites and text. From left to right, their x coordinates each increase by 20 and their y coordinates increase by 2 (camera is pointing down, so higher y = closer to camera).

    So the right most card should be in front, but it is not, either in the editor or playmode. If I rotate the scene view, the cards sometimes seem to jump back to front, but I wouldn't expect z-fighting to occur if the objects are actually at different distances. What's going on?

     
  2. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    what are the values of you sorting ordering in the canvas's?
     
  3. wx3labs

    wx3labs

    Joined:
    Apr 5, 2014
    Posts:
    77
    If you mean order in layer, they are all 0. Since they are world space canvases, I assume further canvases will appear behind closer ones. Is that not how world space canvases work?
     
  4. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    No that fine just wanted to double check that it wasn't a setting causing it. So the most likely issue is that they are all sorted by distance to the camera. The distance is taken from the center of the bounding box. So the card in the middle is "closer" to the camera then the elements to the right / left due to the frustum. I'm not sure what spacing you have but maybe try increasing it.
     
    wx3labs likes this.
  5. wx3labs

    wx3labs

    Joined:
    Apr 5, 2014
    Posts:
    77
    Okay, that sounds plausible, thanks!