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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug urp camera stack get SerializedObject target has been destroyed error

Discussion in 'Universal Render Pipeline' started by cheric, Apr 14, 2023.

  1. cheric

    cheric

    Joined:
    Nov 24, 2014
    Posts:
    8
    Add a camera to the camera stack of urp, then remove it, and then add another camera, an error will be reported like this:

    SerializedObject target has been destroyed.
    UnityEditor.Rendering.Universal.UniversalRenderPipelineCameraEditor:DrawElementCallback (UnityEngine.Rect,int,bool,bool)
    UnityEditorInternal.ReorderableList:DoListElements (UnityEngine.Rect,UnityEngine.Rect)
    UnityEditorInternal.ReorderableList:DoLayoutList ()
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    use Unity 2021.3.4f1 or Unity 2021.3.19f1
    upload_2023-4-14_14-52-7.png

    upload_2023-4-14_14-51-49.png
     
  2. SamuelRoser

    SamuelRoser

    Joined:
    Aug 22, 2017
    Posts:
    1
    bump - having exact same issue;

    In my case I am adding and removing overlay cameras to the camera stack from code to change relevant cameras depending on which scene I load.

    My setup:
    Main UI Scene -
    1. has the MainCamera root object set as base
    2. has the MenuCamera object set to overlay, responsible for displaying UI layer
    StartMenuBackdrop scene -
    1. Added additively
    2. has the Scene Camera object set to overlay, responsible for displaying all other layers relevant for the background
    Main Game Scene
    1. Added additively
    2. has the Game Camera object set to overlay, responsible for displaying all other layers relevant for the game
    For every scene load event I change the cameraStack of the MainCamera to add the respective scene camera to index 0 so that the UI Overlay MenuCamera (then becoming index 1) is displayed above it.

    This causes the errors to be displayed (>500 errors), but the game and everything else seems to work just fine. Not sure if any other issues will arise with this but I don't want to sit on that many error msgs even if just cosmetic. Is this a bug?

    FYI: It only happens if I have the MainCamera GameObject selected and inspector showing the properties. So, I assume it's just a bug on the Editor settings for the camera object and is all Unity's fault :)

    Should be reproducible by following the above steps.
     
    KUBO-Fredrik likes this.