sschmid / Entitas

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

Unity crashes when clicking on a GameObject with Component of Entitas #1064

Open RouderSky opened 1 year ago

RouderSky commented 1 year ago
StackOverflowException: The requested operation caused a stack overflow.
System.Reflection.RuntimePropertyInfo.SetValue (System.Object obj, System.Object value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) (at <75633565436c42f0a6426b33f0132ade>:0)
System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) (at <75633565436c42f0a6426b33f0132ade>:0)
DesperateDevs.Utils.PublicMemberInfo.SetValue (System.Object obj, System.Object value) (at <3cf8f6667aa14c75815ce075234101f0>:0)
Entitas.VisualDebugging.Unity.Editor.EntityDrawer.DrawObjectMember (System.Type memberType, System.String memberName, System.Object value, System.Object target, System.Action2[T1,T2] setValue) (at <67872ecda0424e09adcde3cfef7ad8d6>:0) Entitas.VisualDebugging.Unity.Editor.EntityDrawer.DrawObjectMember (System.Type memberType, System.String memberName, System.Object value, System.Object target, System.Action2[T1,T2] setValue) (at <67872ecda0424e09adcde3cfef7ad8d6>:0)
RouderSky commented 1 year ago
ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at <44335255efcb428fb633c913db3eed7a>:0)
UnityEngine.GUILayoutUtility.DoGetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <44335255efcb428fb633c913db3eed7a>:0)
UnityEngine.GUILayoutUtility.GetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <44335255efcb428fb633c913db3eed7a>:0)
UnityEngine.GUILayout.DoButton (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <44335255efcb428fb633c913db3eed7a>:0)
UnityEngine.GUILayout.Button (System.String text, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <44335255efcb428fb633c913db3eed7a>:0)
DesperateDevs.Unity.Editor.EditorLayout.miniButton (System.String c, UnityEngine.GUIStyle style) (at <055a4d22d68a41038b16fe2b4ed852d5>:0)
DesperateDevs.Unity.Editor.EditorLayout.MiniButton (System.String c) (at <055a4d22d68a41038b16fe2b4ed852d5>:0)
Entitas.VisualDebugging.Unity.Editor.EntityDrawer.DrawObjectMember (System.Type memberType, System.String memberName, System.Object value, System.Object target, System.Action2[T1,T2] setValue) (at <67872ecda0424e09adcde3cfef7ad8d6>:0) Entitas.VisualDebugging.Unity.Editor.EntityDrawer.DrawObjectMember (System.Type memberType, System.String memberName, System.Object value, System.Object target, System.Action2[T1,T2] setValue) (at <67872ecda0424e09adcde3cfef7ad8d6>:0)
RouderSky commented 1 year ago
ArgumentException: Getting control 0's position in a group with only 0 controls when doing repaint
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at <44335255efcb428fb633c913db3eed7a>:0)
UnityEngine.GUILayoutUtility.DoGetRect (System.Single minWidth, System.Single maxWidth, System.Single minHeight, System.Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <44335255efcb428fb633c913db3eed7a>:0)
UnityEngine.GUILayoutUtility.GetRect (System.Single minWidth, System.Single maxWidth, System.Single minHeight, System.Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <44335255efcb428fb633c913db3eed7a>:0)
UnityEditor.EditorGUILayout.GetToggleRect (System.Boolean hasLabel, UnityEngine.GUILayoutOption[] options) (at <11d97693183d4a6bb35c29ae7882c66b>:0)
UnityEditor.EditorGUILayout.Toggle (UnityEngine.GUIContent label, System.Boolean value, UnityEngine.GUILayoutOption[] options) (at <11d97693183d4a6bb35c29ae7882c66b>:0)
UnityEditor.EditorGUILayout.Toggle (System.String label, System.Boolean value, UnityEngine.GUILayoutOption[] options) (at <11d97693183d4a6bb35c29ae7882c66b>:0)
Entitas.VisualDebugging.Unity.Editor.BoolTypeDrawer.DrawAndGetNewValue (System.Type memberType, System.String memberName, System.Object value, System.Object target) (at <67872ecda0424e09adcde3cfef7ad8d6>:0)
Entitas.VisualDebugging.Unity.Editor.EntityDrawer.DrawObjectMember (System.Type memberType, System.String memberName, System.Object value, System.Object target, System.Action2[T1,T2] setValue) (at <67872ecda0424e09adcde3cfef7ad8d6>:0) Entitas.VisualDebugging.Unity.Editor.EntityDrawer.DrawObjectMember (System.Type memberType, System.String memberName, System.Object value, System.Object target, System.Action2[T1,T2] setValue) (at <67872ecda0424e09adcde3cfef7ad8d6>:0)
sschmid commented 1 year ago

Hi! Can you pls post you component? I assume it doesn't have a non trivial type. Entitas entity drawer in Visual Debugging tries to draw any kind of type, in some cases it cannot find a way and will result in a stack overflow. In this case you can either choose to implement your own TypeDrawer or ComponentDrawer, see examples

or add an attribute to now draw the component

RouderSky commented 1 year ago

I don't know which component caused the crash, because there are many components on this GameObject

Discipol commented 1 year ago

I also get this when inspecting any entity in 2022.3.4

alex-moonlitgames commented 12 months ago

This is potentially a duplicate of https://github.com/sschmid/Entitas/issues/1067

RouderSky commented 11 months ago

I know which component is causing the problem 微信截图_20230722170518 I suspect it is AniLayerCfg, can it not be drawn in the inspector interface? @sschmid

sschmid commented 11 months ago

Yes, see comment above: https://github.com/sschmid/Entitas/issues/1064#issuecomment-1597445012

Add [DontDrawComponent] or implement a custom drawer for the component, like https://github.com/sschmid/Entitas/blob/b74c4c3137dc00d7d17c170afad4b1c92de1b92d/src/Entitas.VisualDebugging.Unity.Editor/Vector3TypeDrawer.cs#L7