Search Unity

Question UniversalAdditionalCameraData.SetRenderer does not work with the Scene View Camera

Discussion in 'Universal Render Pipeline' started by viruseg, Nov 27, 2022.

  1. viruseg

    viruseg

    Joined:
    Jul 8, 2017
    Posts:
    23
    I'm trying to change the Renderer of the Scene View Camera. But Unity ignores changing the renderer index.
    It doesn't matter what index I assign to the Scene View Camera. The rendering always happens with an index of zero.
    How do I change the render index of the Scene View Camera?

    Here is the simplified code for maximum understanding:
    Code (CSharp):
    1. var sceneViews = SceneView.sceneViews;
    2. for (var i = 0; i < sceneViews.Count; i++)
    3. {
    4.     var sceneView = (SceneView) sceneViews[i];
    5.     if (sceneView.camera.TryGetComponent(out UniversalAdditionalCameraData sceneViewCameraData))
    6.     {
    7.         sceneViewCameraData.SetRenderer(1);
    8.     }
    9. }
    upload_2022-11-27_8-33-4.png