sschmid / Entitas

Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
MIT License
7.13k stars 1.11k forks source link

"NullReferenceException: Object reference not set to an instance of an object" using code generation in Unity v2017.1.0b4 #414

Closed sdarkwell closed 7 years ago

sdarkwell commented 7 years ago

Error:

NullReferenceException: Object reference not set to an instance of an object Entitas.CodeGeneration.Unity.Editor.UnityCodeGenerator.checkCanGenerate () Entitas.CodeGeneration.Unity.Editor.UnityCodeGenerator.Generate ()

Note: There was no error using prior Unity version v2017.1.0b3

sschmid commented 7 years ago

This method uses internal unity apis to detect compile errors. I assume the latest version might have changed this internal undocumented api. I don't have this Unity version yet, if you want you can run and debug this code: https://github.com/sschmid/Entitas-CSharp/blob/develop/Addons/Entitas.CodeGeneration.Unity.Editor/Entitas.CodeGeneration.Unity.Editor/Editor/UnityCodeGenerator.cs#L60-L72

If you can find the issue I'd be happy to accept a PR

sdarkwell commented 7 years ago

Alright! Pull request submitted.

I've only ever used Git for myself, so apologies if there are any issues with how I submitted the pull request.

sschmid commented 7 years ago

Made another change since compiler flags won't work when shipping dlls 🤦‍♂️ https://github.com/sschmid/Entitas-CSharp/commit/4c99aadb02c1eb897b9e6ddd66f18557b80a3d29

Entitas 0.42.3

burley1 commented 6 years ago

Have the same error (or not?)

ildslave/unity/build/Editor/Mono/EditorGUI.cs:6143)
DesperateDevs.Unity.Editor.PreferencesWindow.drawException (System.Exception exception)
DesperateDevs.Unity.Editor.PreferencesWindow.drawContent ()
DesperateDevs.Unity.Editor.PreferencesWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:107)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt) (at C:/buildslave/unity/build/Runtime/UIElements/Managed/IMGUIContainer.cs:179)

Entitas - 0.46.3 Unity 2017.3.0f3 screenshot

tangeping commented 5 years ago

I have the same error

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:296)
UnityEditor.EditorGUILayout.BeginHorizontal (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7787)
UnityEditor.EditorGUILayout.BeginHorizontal (UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7767)
UnityEditor.EditorGUILayout.LabelField (UnityEngine.GUIContent label, UnityEngine.GUIContent label2, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:6192)
UnityEditor.EditorGUILayout.LabelField (System.String label, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:6148)
DesperateDevs.Unity.Editor.PreferencesWindow.drawException (System.Exception exception)
DesperateDevs.Unity.Editor.PreferencesWindow.drawContent ()
DesperateDevs.Unity.Editor.PreferencesWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:107)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt) (at C:/buildslave/unity/build/Runtime/UIElements/Managed/IMGUIContainer.cs:182)

Entitas 1.13.0 Unity 2017.3.1p1

image