Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Screen Space - Camera No Plane distance

Discussion in 'UGUI & TextMesh Pro' started by IterativeKing, Apr 14, 2022.

  1. IterativeKing

    IterativeKing

    Joined:
    Apr 17, 2019
    Posts:
    5
    Hello,

    So I updated Unity to 2021 LTS and it broke screen space overlay shader graph UI materials. I changed my render mode to screen space - camera. However, elements can now draw over the UI based on the plane distance. Altering the plane distance affects the UI's scale, which has A LOT of negative effects on various elements (mainly text mesh components). Also, it is impossible to set a distance (e.g. 0) that has the UI sitting on top of all other objects.

    My first thought is to stack cameras and have one render the UI but I feel like this is extra processing that does not need to be done. Is there any way to have a screen space overlay per camera without plane distance? I am curious of the performance loss of having to stack cameras to pull this off.

    Some notes:
    • I updated from a previous 2021 version
    • Project is and always ways built using URP
    • I've included an image and explanation of the shader issue just for curiosity's sake
    • I potentially want split screen capabilities in the future, so I am fine with screen space overlay
    Fig. Shader Error:
    Transparency effects no longer properly display for screen space overlay (using shader graph). Everything is set up correctly and it was previously working. Funny enough it looks fine in the editor window.

    Cheers,
    Miles
     

    Attached Files:

    Last edited: Apr 14, 2022
  2. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    I have a question for you and not trying to high jack.
    Is the failure you are experiencing have anything to do with the enhancements and bug fixes in the Unity version release docos?
    I am curious because I never see any connection items posted concerning related issues.
     
  3. IterativeKing

    IterativeKing

    Joined:
    Apr 17, 2019
    Posts:
    5
    I think in this thread (or some other one), someone else experienced the same issue jumping from x to 2021 LTS. So Unity has done something that changes how shader graph (sprite unlit) materials interact with UI images. I was just on a previous 2021.1.x and it was working fine until I upgraded. Just to clarify, I tried everything and it is only an issue when you are using screen space overlay. Perhaps it is the order in which shaders do things (blending and what not)
     
  4. Tehenauin

    Tehenauin

    Joined:
    Oct 18, 2018
    Posts:
    45
    I am experiencing the same problem. We updated from 2019 to 2021 LTS. At this point, it worked fine, but then we also went from legacy to URP and after fixing some other shader and camera stacking issues I stumbled across the same problem as described above. When increasing the plane distance of the one cameraSpace canvas on one of my overlay cameras. When increasing the distance, it scales up, this is expected with a perspective camera, the problem is, that the actual distance to the camera is incorrect and happens in weird steps, that I dont understand. The funny thing is, that I have a second cameraSpace canvas on another overlay camera, but this one is working fine and behaves as expected when changing the plane distance. The one that behaves weirdly is added at runtime as part of an assetbundle. The other one is part of the scene from the beginning.

    EDIT:
    okay, I found the reason, why it is only broken on one of the canvases. The one where the issue appears has one image with a custom shader. Removing the shader makes it work again.
     
    Last edited: May 10, 2022