I have been following the tutorials and everything seems to be working as shown in the videos, however I am getting the following error in two scenarios:
NullReferenceException: SerializedObject of SerializedProperty has been Disposed.
To replicate: Select or create a new “Dialogue” element. Manually add a node using the + button in the inspector. When you save or when you change the name of the “Dialogue” file, the error occurs. This does not happen when a “default node” is made following the method in the “creating a default node lecture” Apart from the error, everything works as expected. The new node does get saved and will reload when reopening the file. Does anyone know what the issue is or how to prevent this? Could this cause a problem later on or is it fine to just ignore it? I’m using Unity 2022.11f1. The code I’m using:
Dialogue.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RPG.Dialogue
{
[CreateAssetMenu(fileName = “New Dialogue”, menuName = “Dialogue”, order = 0)]
public class Dialogue : ScriptableObject
{
[SerializeField]
List nodes = new List();
}
}
DialogueNodes.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RPG.Dialogue
{
[System.Serializable]
public class DialogueNode
{
public string uniqueID;
public string text;
public string children;
public Rect rect = new Rect (0,0,200,100);
}
}
The full error is below.
Thanks!
NullReferenceException: SerializedObject of SerializedProperty has been Disposed.
UnityEditor.SerializedProperty.get_intValue () (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEditor.UIElements.Bindings.ListViewSerializedObjectBinding.UnbindListViewItem (UnityEngine.UIElements.VisualElement ve, System.Int32 index) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEngine.UIElements.ListViewController.UnbindItem (UnityEngine.UIElements.VisualElement element, System.Int32 index) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEngine.UIElements.CollectionViewController.InvokeUnbindItem (UnityEngine.UIElements.ReusableCollectionItem reusableItem, System.Int32 index) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEngine.UIElements.VerticalVirtualizationController1[T].ReleaseItem (System.Int32 activeItemsIndex) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0) UnityEngine.UIElements.DynamicHeightVirtualizationController
1[T].ReleaseItem (System.Int32 activeItemsIndex) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEngine.UIElements.VerticalVirtualizationController1[T].Refresh (System.Boolean rebuild) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0) UnityEngine.UIElements.DynamicHeightVirtualizationController
1[T].Refresh (System.Boolean rebuild) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEngine.UIElements.BaseVerticalCollectionView.RefreshItems () (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEngine.UIElements.CollectionViewController.set_itemsSource (System.Collections.IList value) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEngine.UIElements.BaseVerticalCollectionView.set_itemsSource (System.Collections.IList value) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEditor.UIElements.Bindings.ListViewSerializedObjectBinding.ClearListView () (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.ListViewSerializedObjectBinding.Release () (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.RemoveBinding (UnityEngine.UIElements.IBindable bindable, System.Boolean forceRemove) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.Unbind (UnityEngine.UIElements.VisualElement element) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.DefaultSerializedObjectBindingImplementation.UnbindTree (UnityEngine.UIElements.VisualElement element) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.DefaultSerializedObjectBindingImplementation.Unbind (UnityEngine.UIElements.VisualElement element) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.BindingExtensions.Unbind (UnityEngine.UIElements.VisualElement element) (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEditor.UIElements.PropertyField.Reset (UnityEditor.SerializedProperty newProperty) (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEditor.UIElements.PropertyField.Reset (UnityEditor.UIElements.SerializedPropertyBindEvent evt) (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEditor.UIElements.PropertyField.ExecuteDefaultActionAtTarget (UnityEngine.UIElements.EventBase evt) (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetAndDefaultPhase (UnityEngine.UIElements.EventBase evt) (at <7c69dfc1e63a4ea388c73014d3c7ce20>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.SendBindingEvent[TEventType] (TEventType evt, UnityEngine.UIElements.VisualElement target) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindPropertyRelative (UnityEngine.UIElements.IBindable field, UnityEditor.SerializedProperty parentProperty) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindTree (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindTree (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindTree (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.ContinueBinding (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.Bind (UnityEngine.UIElements.VisualElement element) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.Bindings.DefaultSerializedObjectBindingImplementation.Bind (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedObject obj) (at <8c3449848bd845499081ddbe4a09b367>:0)
UnityEditor.UIElements.BindingExtensions.Bind (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedObject obj) (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEditor.UIElements.InspectorElement.SetEditor (UnityEditor.Editor value) (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEditor.UIElements.EditorElement.Reinit (System.Int32 editorIndex) (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEditor.PropertyEditor.ProcessEditorElementsToRebuild (UnityEditor.Editor editors) (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEditor.PropertyEditor.DrawEditors (UnityEditor.Editor editors) (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEditor.PropertyEditor.RebuildContentsContainers () (at <9920ff0c944845d7b9f9a61ef1478edc>:0)
UnityEditor.InspectorWindow.RedrawFromNative () (at <9920ff0c944845d7b9f9a61ef1478edc>:0)