- Home /
NullReferenceException: SerializedObject of SerializedProperty has been Disposed
II just started Unity and my English is not very good. Sorry about that. Although I do everything according to Unity's tutorials. After writing the code in Visual Studio, it gives this error when I press the play button in Unity. And it doesn't run the code I wrote. How do I fix this and what's the problem? I get an error like this:
NullReferenceException: SerializedObject of SerializedProperty has been Disposed. UnityEditor.SerializedProperty.set_objectReferenceValue (UnityEngine.Object value) (at :0) UnityEngine.InputSystem.Editor.PlayerInputEditor+<>c_DisplayClass6_0.b_0 () (at Library/PackageCache/com.unity.inputsystem@1.0.1/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs:285) UnityEditor.EditorApplication.Internal_CallDelayFunctions () (at :0)
Answer by Petrusion · Dec 22, 2020 at 04:52 PM
I'm not sure but in C# if you cannot use something because it has been disposed that means you must've called .Dispose() on some object or put it in a using( ) { } statement in a method, which calls Dispose on the object implicitly. In Visual Studio, I'd try Ctrl + F, set the scope to "Current project" and search for "using(", "using (" and "Dispose()"
Answer by sasabatu · Dec 22, 2020 at 06:11 PM
I solved my problem in another way, but I will keep in mind what you said if I experience something similar again. Thank you.