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’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Bug NullReferenceException: SerializedObject of SerializedProperty has been Disposed

Discussion in 'Editor & General Support' started by jessee03, Jun 2, 2023.

  1. jessee03

    jessee03

    Joined:
    Apr 27, 2011
    Posts:
    729
    I am getting this error randomly after updating to the latest version of unity ( 2022.2.21f1 ) NullReferenceException: SerializedObject of SerializedProperty has been Disposed. I am unable to figure out what is causing this issue, error log wont take me to the code that is the issue. If I restart unity it goes away. If i enter playmode and then exit the error will start again. I get thousands of these errors.

    EDIT: I found that this issue happens when selecting any object in the editor. If I deselect all objects so I have nothing selected I do not get this error

    EDIT: Restarting unity, deleting library folder, resetting ui. Fixes the issue for a few minutes then the error returns.

    EDIT: Upgraded to 2022.3.0f1 and am running into the issue less but seems to occur when messing with array lists in the inspector, also still happening when selection any object in the scene view

    Code (CSharp):
    1. NullReferenceException: SerializedObject of SerializedProperty has been Disposed.
    2. UnityEditor.SerializedProperty.get_objectReferenceInstanceIDValue () (at <a445319feeee47ac85466210448edf2f>:0)
    3. UnityEditor.EditorGUIUtility.ObjectContent (UnityEngine.Object obj, System.Type type, UnityEditor.SerializedProperty property, UnityEditor.EditorGUI+ObjectFieldValidator validator) (at <a445319feeee47ac85466210448edf2f>:0)
    4. UnityEditor.UIElements.ObjectField+ObjectFieldDisplay.Update () (at <a445319feeee47ac85466210448edf2f>:0)
    5. UnityEditor.UIElements.ObjectField.UpdateDisplay () (at <a445319feeee47ac85466210448edf2f>:0)
    6. UnityEngine.UIElements.VisualElement+SimpleScheduledItem.PerformTimerUpdate (UnityEngine.UIElements.TimerState state) (at <618b8429084e4d328aacffdfa23cfc2d>:0)
    7. UnityEngine.UIElements.TimerEventScheduler.UpdateScheduledEvents () (at <618b8429084e4d328aacffdfa23cfc2d>:0)
    8. UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.UpdateSchedulers () (at <618b8429084e4d328aacffdfa23cfc2d>:0)
    9. UnityEngine.UIElements.UIEventRegistration.UpdateSchedulers () (at <618b8429084e4d328aacffdfa23cfc2d>:0)
    10. UnityEditor.RetainedMode.UpdateSchedulers () (at <a7717f1c634f4059922ea89761126092>:0)
     
    Last edited: Jun 2, 2023
  2. Manufacture43

    Manufacture43

    Joined:
    Apr 21, 2017
    Posts:
    140
    We're having this bug too since upgrading to 2022.3.6f1. We're also thinking it's related to arrays
     
  3. Paul1379

    Paul1379

    Joined:
    Apr 20, 2022
    Posts:
    1
    J’ai le même problème avec deux tableaux justement qui ne s’affichent plus dans l’inspecteur..
     
  4. alanbrambila

    alanbrambila

    Joined:
    Jun 22, 2023
    Posts:
    1
    Having the same issue. Started this week after a complex logic implementation using a array of struct and a few <int,int> dictionarys (declared inside the scope of the method) in a MonoBehaviour class.

    This public array of struct already existed before and was consumed by simpler methods in this and other classes, so I believe it is not related to its existence in the serialization of this class fields.

    I'm using Unity 2022.3.7f1

    EDIT:
    Useful information: happens mostly when attached to Visual Studio for debug.
    After exiting play mode the exception continues to throw until closing the Editor.


    Code (CSharp):
    1. NullReferenceException: SerializedObject of SerializedProperty has been Disposed.
    2. UnityEditor.SerializedProperty.Verify (UnityEditor.SerializedProperty+VerifyFlags verifyFlags) (at <97436df440ca462884c5332c1d8ebbe7>:0)
    3. UnityEditor.SerializedProperty.get_objectReferenceInstanceIDValue () (at <97436df440ca462884c5332c1d8ebbe7>:0)
    4. UnityEditor.EditorGUIUtility.ObjectContent (UnityEngine.Object obj, System.Type type, UnityEditor.SerializedProperty property, UnityEditor.EditorGUI+ObjectFieldValidator validator) (at <97436df440ca462884c5332c1d8ebbe7>:0)
    5. UnityEditor.UIElements.ObjectField+ObjectFieldDisplay.Update () (at <97436df440ca462884c5332c1d8ebbe7>:0)
    6. UnityEditor.UIElements.ObjectField.UpdateDisplay () (at <97436df440ca462884c5332c1d8ebbe7>:0)
    7. UnityEngine.UIElements.VisualElement+SimpleScheduledItem.PerformTimerUpdate (UnityEngine.UIElements.TimerState state) (at <9d7fc877145d4138982bf12cdd3484c6>:0)
    8. UnityEngine.UIElements.TimerEventScheduler.UpdateScheduledEvents () (at <9d7fc877145d4138982bf12cdd3484c6>:0)
    9. UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.UpdateSchedulers () (at <9d7fc877145d4138982bf12cdd3484c6>:0)
    10. UnityEngine.UIElements.UIEventRegistration.UpdateSchedulers () (at <9d7fc877145d4138982bf12cdd3484c6>:0)
    11. UnityEditor.RetainedMode.UpdateSchedulers () (at <f90f2d9cb28d4393afc1338e6af635e0>:0)