- changed status to resolved
New ABG cause exception
Issue #62
resolved
When I create a new AB Graph and Drag and Drop asset directory to ABG, Unity (5.6.x) Editor's console shows the following error:
ArgumentException: Getting control 0's position in a group with only 0 controls when doing dragPerform
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/LayoutGroup.cs:115)
UnityEngine.GUILayoutUtility.DoGetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:413)
UnityEngine.GUILayoutUtility.GetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:373)
UnityEngine.AssetBundles.GraphTool.AssetBundleGraphEditorWindow.DrawGUINodeGraph () (at Assets/UnityEngine.AssetBundleGraph/Editor/GUI/AssetBundleGraphEditorWindow.cs:958)
UnityEngine.AssetBundles.GraphTool.AssetBundleGraphEditorWindow.OnGUI () (at Assets/UnityEngine.AssetBundleGraph/Editor/GUI/AssetBundleGraphEditorWindow.cs:1143)
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)
Unfortunately, since UnityEngine.GUILayoutUtility
and GUILayoutGroup
don't have public functionality which allows to check GUILayoutGroup.entries.Count
, we can't check it without exception.
But it seems that it just utilize side effect of GUILayoutUtility.GetRect()
, I think we can add the following condition to avoid this error:
UnityEngine.AssetBundles.GraphTool.AssetBundleGraphEditorWindow.DrawGUINodeGraph () {
...
// set rect for scroll.
if (nodes.Any()) {
UpdateSpacerRect();
+ if(Event.current.type == EventType.Layout) {
GUILayoutUtility.GetRect(new GUIContent(string.Empty), GUIStyle.none, GUILayout.Width(spacerRectRightBottom.x), GUILayout.Height(spacerRectRightBottom.y));
+ }
...
}
Comments (2)
-
-
@t-mat Thanks for looking into this. Confirmed that proposed fix works - it is fixed in 1.3.
- Log in to comment
Fixing issue
#62→ <<cset 4e2969f4643b>>