Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null reference if viewing a gameobject with null script #161

Closed
pippinmole opened this issue May 25, 2020 · 3 comments
Closed

Null reference if viewing a gameobject with null script #161

pippinmole opened this issue May 25, 2020 · 3 comments

Comments

@pippinmole
Copy link

NullReferenceException: Object reference not set to an instance of an object NaughtyAttributes.Editor.ReflectionUtility+<GetAllFields>d__0.MoveNext () (at Assets/Decay.Utilities/NaughtyAttributes/Editor/Utility/ReflectionUtility.cs:12) System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Boolean& found) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) NaughtyAttributes.Editor.ReflectionUtility.GetField (System.Object target, System.String fieldName) (at Assets/Decay.Utilities/NaughtyAttributes/Editor/Utility/ReflectionUtility.cs:71) NaughtyAttributes.Editor.PropertyUtility.GetAttributes[T] (UnityEditor.SerializedProperty property) (at Assets/Decay.Utilities/NaughtyAttributes/Editor/Utility/PropertyUtility.cs:20) NaughtyAttributes.Editor.PropertyUtility.GetAttribute[T] (UnityEditor.SerializedProperty property) (at Assets/Decay.Utilities/NaughtyAttributes/Editor/Utility/PropertyUtility.cs:14) NaughtyAttributes.Editor.NaughtyInspector+<>c.<OnInspectorGUI>b__6_0 (UnityEditor.SerializedProperty p) (at Assets/Decay.Utilities/NaughtyAttributes/Editor/NaughtyInspector.cs:39) System.Linq.Enumerable.Any[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] predicate) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) NaughtyAttributes.Editor.NaughtyInspector.OnInspectorGUI () (at Assets/Decay.Utilities/NaughtyAttributes/Editor/NaughtyInspector.cs:39) UnityEditor.UIElements.InspectorElement+<>c__DisplayClass55_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <90d4bcb003fb405fb09241aed2f178aa>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

How to reproduce:

  1. Create a script
  2. Attach it to a gameobject
  3. Remove the script from project files
  4. View gameobject and inspect console
@fmoo
Copy link
Contributor

fmoo commented May 25, 2020

I ran into a similar issue when I accidentally added a second ScriptableObject subclass to a file that already had one.

@slimshader
Copy link

Confirmed also

@dbrizov
Copy link
Owner

dbrizov commented Aug 2, 2020

Fixed in 842f290

@dbrizov dbrizov closed this as completed Aug 2, 2020
github-actions bot pushed a commit that referenced this issue Aug 21, 2020
…jects with deleted scripts that use naughty attributes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants