Search Unity

Can UIElements / PanelRenderer only show on 1 Display / Camera?

Discussion in 'UI Toolkit' started by cruxxxxxxx, May 15, 2020.

  1. cruxxxxxxx

    cruxxxxxxx

    Joined:
    Aug 3, 2015
    Posts:
    5
    Hi, it seems there's no support for UIElements using runtime UI & panel renderer to be layer masked because they aren't in camera / world space but overlayed on the camera.

    I have a setup right now where I have UI elements on Display 1 and game elements on Display 2. PanelRenderer overlays the UI on both displays. Is there any way for me to make it so it does not show on Display 2?

    Thanks!

    - Mike
     
  2. cruxxxxxxx

    cruxxxxxxx

    Joined:
    Aug 3, 2015
    Posts:
    5
    I also wouldn't mind rendering to a RenderTexture but I can't get that to work either ...
     
  3. mcoted3d

    mcoted3d

    Unity Technologies

    Joined:
    Feb 3, 2016
    Posts:
    1,003
    A PanelRenderer in overlay mode isn't associated with any camera, it will be rendered after every camera is done rendering.

    Assigning a RenderTexture to the "Target Texture" of the PanelRenderer should work though. Can you share which version of Unity and the package you are using?
     
  4. cruxxxxxxx

    cruxxxxxxx

    Joined:
    Aug 3, 2015
    Posts:
    5
    Hey, I'm using

    Unity 2019.3.2f1
    "com.unity.ui.runtime" : "0.0.4-preview",
    "com.unity.ui.builder": "0.11.1-preview",
    "com.unity.modules.uielements": "1.0.0",


    When I add the RenderTexture to the PanelRenderer.TargetTexture, it doesn't write.

    I also receive this warning:
    PanelRenderer needs an IWorldTransform implementation for world-space rendering

    But that appears unrelated?
     
  5. mcoted3d

    mcoted3d

    Unity Technologies

    Joined:
    Feb 3, 2016
    Posts:
    1,003
    This is odd, it seems that the PanelRenderer is configured in "world space" mode, which isn't an exposed feature as far as I can tell.

    Can you try to recreate the PanelRenderer component from scratch? It should be in overlay mode by default.
     
  6. cruxxxxxxx

    cruxxxxxxx

    Joined:
    Aug 3, 2015
    Posts:
    5
    I only receive the world space error when I put the render texture on.

    Not sure what you mean by create from scratch. I've tried deleting and readding the component to my GameObject and still get the error.

    I also tried using the PanelRenderer from the demo git repo (https://github.com/Unity-Technologies/UIElementsUniteCPH2019RuntimeDemo) and from the upm runtime preview repo. Both give the same error.
     
  7. mcoted3d

    mcoted3d

    Unity Technologies

    Joined:
    Feb 3, 2016
    Posts:
    1,003
    I cannot reproduce here. I'm attaching a simple project to this post. This is a simple PanelRenderer with a UXML file (authored with the UI Builder) and a RenderTexture as a render target. If you can:
    1. Validate that it works on your side and
    2. Compare with what you have to see if there's any difference
    That could help us figure out what is going on. Thanks!
     

    Attached Files: