Search Issue Tracker

Active

Under Consideration for 6000.5.X

Votes

0

Found in

6000.0.69f1

6000.3.10f1

6000.4.0b11

6000.5.0a8

Issue ID

UUM-135721

Regression

No

“GUIStyle” and “NullReferenceException” errors thrown in the Console when opening Object Field during script compilation

IMGUI Framework

-

Steps to reproduce:
1. Create new Unity project
2. In Project window create new script
3. While new script is compiling select “Global Volume” in Hierarchy window
4. In Inspector window select Volume > Sample Scene Profile Object field
5. Observe the Console window

Actual results: “Unable to use a named GUIStyle without a current skin. Most likely you need to move your GUIStyle initialization code to OnGUI” and “NullReferenceException: Object reference not set to an instance of an object” errors are thrown in the Console window, object selection window breaks, doesn’t show anything

Expected results: No errors are thrown in the Console window, object selection window doesn’t break

Reproducible with versions: 6000.0.69f1, 6000.3.10f1, 6000.4.0b11, 6000.5.0a8

Tested on (OS): macOS Silicon Tahoe 26.3 (M1), Ubuntu 24.04

Notes:

  •  For longer compiling time, ScriptableObject Script can be created instead
  • On 6000.0.69f1 different “NullReferenceException” errors are thrown:

{code:java}
NullReferenceException: SerializedObject of SerializedProperty has been Disposed.
UnityEditor.SerializedProperty.Verify (UnityEditor.SerializedProperty+VerifyFlags verifyFlags) (at /Users/bokken/build/output/unity/unity/Editor/Mono/SerializedProperty.bindings.cs:517)
UnityEditor.SerializedProperty.get_propertyType () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SerializedProperty.bindings.cs:1013)
UnityEditor.EditorGUILayout.IsChildrenIncluded (UnityEditor.SerializedProperty prop) (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorGUILayout.cs:2084)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorGUILayout.cs:2068)
UnityEditor.TransformInspector.Inspector3D () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/TransformInspector.cs:85)
UnityEditor.TransformInspector.OnInspectorGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/TransformInspector.cs:49)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass79_0.<CreateInspectorElementUsingIMGUI>b__2 () (at /Users/bokken/build/output/unity/unity/Editor/Mono/UIElements/Inspector/InspectorElement.cs:779)
UnityEditor.ObjectSelector:OnDisable() (at /Users/bokken/build/output/unity/unity/Editor/Mono/ObjectSelector.cs:215)
{code}

  • 6000.3+ warnings:


{code:java}
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ObjectSelector.GetSearchFilter () (at /Users/bokken/build/output/unity/unity/Editor/Mono/ObjectSelector.cs:488)
UnityEditor.ObjectSelector.FilterSettingsChanged () (at /Users/bokken/build/output/unity/unity/Editor/Mono/ObjectSelector.cs:443)
UnityEditor.ObjectSelector.InitIfNeeded () (at /Users/bokken/build/output/unity/unity/Editor/Mono/ObjectSelector.cs:827)
UnityEditor.ObjectSelector.CreateGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/ObjectSelector.cs:1115)
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <3eb0070ec3184acfa9cdfc9616bb21ab>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <3eb0070ec3184acfa9cdfc9616bb21ab>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <3eb0070ec3184acfa9cdfc9616bb21ab>:0)
UnityEditor.UIElements.DefaultEditorWindowBackend.Invoke (System.String methodName) (at /Users/bokken/build/output/unity/unity/Modules/UIElementsEditor/WindowBackends/DefaultEditorWindowBackend.cs:387)
UnityEditor.RetainedMode:UpdateSchedulers() (at /Users/bokken/build/output/unity/unity/Modules/UIElementsEditor/RetainedMode.cs:43)
{code}
{code:java}
Unable to use a named GUIStyle without a current skin. Most likely you need to move your GUIStyle initialization code to OnGUI
UnityEditor.RetainedMode:UpdateSchedulers () (at /Users/bokken/build/output/unity/unity/Modules/UIElementsEditor/RetainedMode.cs:43)
{code}

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.