Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feature Request World Space canvas - when?

Discussion in 'Universal Render Pipeline' started by laurentlavigne, Jan 13, 2021.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,840
    I'm working on the UI and off course I need world space canvas so the UI follows 3D objects
    It doesn't work in URP 8.31
    Which version or when does it work?
     
  2. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    429
    I'm using URP 10.2.2 at the moment with 2020.2.1f1 which works for me. I'm pretty sure it worked before that as well. What problems are you experiencing?
     
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,840
    In a setup with multiple world canvas and multiple overlay cameras the UI displays on only one camera.
     
  4. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,840
    like so
    topmost object is in one camera and the two below have their own overlay cameras

    upload_2021-1-15_10-25-40.png
     
  5. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    429
    In the default URP scene, I added one more camera, set it to overlay and added it to the base camera stack. I disabled post processing in the overlay camera, so it doesn't do that twice on the whole image. I also set the overlay cameras culling mask to "UI" only.

    I then added a world space canvas with a button, so there's something to see (on the UI layer). The button renders in both cameras. I attached my scene at a unitypackage. Just create an empty URP scene and import this. I used 2020.2.1f to create this but maybe it also imports on older versions.

    I noticed you're using multiple cameras, one for each canvas. This is usually not necessary. If they're world space canvases, they're rendered just like any other object. The "event camera" is only necessary, when the canvases have interactive elements that you can click.

    I can not see the setup of the respective cameras in your screenshots. Maybe there's something wrong with the culling layers? When you click one of the overlay cameras, you can see a small preview of it in the scene view. For the overlay cameras, only be the canvases without the rest of the scene should be visible. I can imagine you're overwriting the render output of one camera by rendering the whole scene again on top with an overlay camera.
     

    Attached Files:

  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,840
    Your setup has 1 world space UI overlay camera and my setup has 2, each with different culling layer, coordinates and FOV

    I f̶i̶g̶u̶r̶e̶d̶ ̶i̶t̶ ̶o̶u̶t̶ stumbled on the solution: the world canvas was on the other camer's culling layer. it needs to be on the culling layer of the camera you want to render on. Makes sense. Didn't know that.