NaughtyAttributes icon indicating copy to clipboard operation
NaughtyAttributes copied to clipboard

"Target object is null" error spam every time I interact with an inspector that has a Canvas

Open trzy opened this issue 2 years ago • 3 comments

Certain objects seem to trigger this error:

The target object is null. Check for missing scripts.
UnityEngine.Debug:LogError (object)
NaughtyAttributes.Editor.ReflectionUtility/<GetAllFields>d__0:MoveNext () (at Library/PackageCache/com.dbrizov.naughtyattributes@c5140c7dc3/Scripts/Editor/Utility/ReflectionUtility.cs:16)
System.Linq.Enumerable:FirstOrDefault<System.Reflection.FieldInfo> (System.Collections.Generic.IEnumerable`1<System.Reflection.FieldInfo>)
NaughtyAttributes.Editor.ReflectionUtility:GetField (object,string) (at Library/PackageCache/com.dbrizov.naughtyattributes@c5140c7dc3/Scripts/Editor/Utility/ReflectionUtility.cs:91)
NaughtyAttributes.Editor.PropertyUtility:GetAttributes<NaughtyAttributes.INaughtyAttribute> (UnityEditor.SerializedProperty) (at Library/PackageCache/com.dbrizov.naughtyattributes@c5140c7dc3/Scripts/Editor/Utility/PropertyUtility.cs:20)
NaughtyAttributes.Editor.PropertyUtility:GetAttribute<NaughtyAttributes.INaughtyAttribute> (UnityEditor.SerializedProperty) (at Library/PackageCache/com.dbrizov.naughtyattributes@c5140c7dc3/Scripts/Editor/Utility/PropertyUtility.cs:14)
NaughtyAttributes.Editor.NaughtyInspector/<>c:<OnInspectorGUI>b__7_0 (UnityEditor.SerializedProperty) (at Library/PackageCache/com.dbrizov.naughtyattributes@c5140c7dc3/Scripts/Editor/NaughtyInspector.cs:40)
System.Linq.Enumerable:Any<UnityEditor.SerializedProperty> (System.Collections.Generic.IEnumerable`1<UnityEditor.SerializedProperty>,System.Func`2<UnityEditor.SerializedProperty, bool>)
NaughtyAttributes.Editor.NaughtyInspector:OnInspectorGUI () (at Library/PackageCache/com.dbrizov.naughtyattributes@c5140c7dc3/Scripts/Editor/NaughtyInspector.cs:40)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Has anyone else experienced this?

I'm using the Hairibar Ragdoll package, which brings in NaughtyAttributes as a dependency. Currently, I've created a new project from scratch and am not even explicitly using anything from any of these packages yet.

trzy avatar Dec 28 '22 01:12 trzy

I got this on mouse over to the "Missing Script" (dead) component. So fix or remove the dead component should do it. Or better, add null check to NaughtyAttributes code to prevent this annoying error, but you are on your own on this. ;) image

wappenull avatar Jan 09 '23 08:01 wappenull

Like wappenull said, but this may help you actually finding it: FindMissingScriptsRecursively

TylerTemp avatar Feb 23 '24 09:02 TylerTemp

I'm getting that same error too

UnityEngine.Debug:LogError (object)
NaughtyAttributes.Editor.ReflectionUtility/<GetAllFields>d__0:MoveNext () (at Assets/_Scripts/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs:15)
System.Linq.Enumerable:FirstOrDefault<System.Reflection.FieldInfo> (System.Collections.Generic.IEnumerable`1<System.Reflection.FieldInfo>)
NaughtyAttributes.Editor.ReflectionUtility:GetField (object,string) (at Assets/_Scripts/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs:82)
NaughtyAttributes.Editor.PropertyUtility:GetAttributes<NaughtyAttributes.INaughtyAttribute> (UnityEditor.SerializedProperty) (at Assets/_Scripts/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs:20)
NaughtyAttributes.Editor.PropertyUtility:GetAttribute<NaughtyAttributes.INaughtyAttribute> (UnityEditor.SerializedProperty) (at Assets/_Scripts/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs:14)
NaughtyAttributes.Editor.NaughtyInspector/<>c:<OnInspectorGUI>b__7_0 (UnityEditor.SerializedProperty) (at Assets/_Scripts/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs:40)
System.Linq.Enumerable:Any<UnityEditor.SerializedProperty> (System.Collections.Generic.IEnumerable`1<UnityEditor.SerializedProperty>,System.Func`2<UnityEditor.SerializedProperty, bool>)
NaughtyAttributes.Editor.NaughtyInspector:OnInspectorGUI () (at Assets/_Scripts/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs:40)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

PalaNolho avatar May 10 '24 14:05 PalaNolho