中级玩家
 
- 贡献度
- 1
- 金元
- 1897
- 积分
- 194
- 精华
- 0
- 注册时间
- 2004-8-17
|
MOD 有BUG
[00:59:33.219] [ERROR] [NPC竞技场] Il2CppInterop.Runtime.Il2CppException: System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
--- BEGIN IL2CPP STACK TRACE ---
System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
at UnityEngine.GUILayoutGroup.GetNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, System.Boolean alwaysShowHorizontal, System.Boolean alwaysShowVertical, UnityEngine.GUIStyle horizontalScrollbar, UnityEngine.GUIStyle verticalScrollbar, UnityEngine.GUIStyle background, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
--- END IL2CPP STACK TRACE ---
at Il2CppInterop.Runtime.Il2CppException.RaiseExceptionIfNecessary(IntPtr returnedException) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Runtime/Il2CppException.cs:line 36
at UnityEngine.GUILayout.BeginScrollView(Vector2 scrollPosition, Il2CppReferenceArray`1 options)
at NpcDuelMod.Plugin.OnGUI()
at MelonLoader.MelonEventBase`1.Invoke(Action`1 delegateInvoker) in D:\a\MelonLoader\MelonLoader\MelonLoader\Melons\Events\MelonEvent.cs:line 143
[00:59:33.231] [ERROR] [NPC竞技场] Il2CppInterop.Runtime.Il2CppException: System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
--- BEGIN IL2CPP STACK TRACE ---
System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
at UnityEngine.GUILayoutGroup.GetNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, System.Boolean alwaysShowHorizontal, System.Boolean alwaysShowVertical, UnityEngine.GUIStyle horizontalScrollbar, UnityEngine.GUIStyle verticalScrollbar, UnityEngine.GUIStyle background, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
--- END IL2CPP STACK TRACE ---
at Il2CppInterop.Runtime.Il2CppException.RaiseExceptionIfNecessary(IntPtr returnedException) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Runtime/Il2CppException.cs:line 36
at UnityEngine.GUILayout.BeginScrollView(Vector2 scrollPosition, Il2CppReferenceArray`1 options)
at NpcDuelMod.Plugin.OnGUI()
at MelonLoader.MelonEventBase`1.Invoke(Action`1 delegateInvoker) in D:\a\MelonLoader\MelonLoader\MelonLoader\Melons\Events\MelonEvent.cs:line 143
[00:59:33.246] [ERROR] [NPC竞技场] Il2CppInterop.Runtime.Il2CppException: System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
--- BEGIN IL2CPP STACK TRACE ---
System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
at UnityEngine.GUILayoutGroup.GetNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, System.Boolean alwaysShowHorizontal, System.Boolean alwaysShowVertical, UnityEngine.GUIStyle horizontalScrollbar, UnityEngine.GUIStyle verticalScrollbar, UnityEngine.GUIStyle background, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
--- END IL2CPP STACK TRACE ---
at Il2CppInterop.Runtime.Il2CppException.RaiseExceptionIfNecessary(IntPtr returnedException) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Runtime/Il2CppException.cs:line 36
at UnityEngine.GUILayout.BeginScrollView(Vector2 scrollPosition, Il2CppReferenceArray`1 options)
at NpcDuelMod.Plugin.OnGUI()
at MelonLoader.MelonEventBase`1.Invoke(Action`1 delegateInvoker) in D:\a\MelonLoader\MelonLoader\MelonLoader\Melons\Events\MelonEvent.cs:line 143
[00:59:33.261] [ERROR] [NPC竞技场] Il2CppInterop.Runtime.Il2CppException: System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
--- BEGIN IL2CPP STACK TRACE ---
System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
at UnityEngine.GUILayoutGroup.GetNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, System.Boolean alwaysShowHorizontal, System.Boolean alwaysShowVertical, UnityEngine.GUIStyle horizontalScrollbar, UnityEngine.GUIStyle verticalScrollbar, UnityEngine.GUIStyle background, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
--- END IL2CPP STACK TRACE ---
at Il2CppInterop.Runtime.Il2CppException.RaiseExceptionIfNecessary(IntPtr returnedException) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Runtime/Il2CppException.cs:line 36
at UnityEngine.GUILayout.BeginScrollView(Vector2 scrollPosition, Il2CppReferenceArray`1 options)
at NpcDuelMod.Plugin.OnGUI()
at MelonLoader.MelonEventBase`1.Invoke(Action`1 delegateInvoker) in D:\a\MelonLoader\MelonLoader\MelonLoader\Melons\Events\MelonEvent.cs:line 143
[00:59:33.276] [ERROR] [NPC竞技场] Il2CppInterop.Runtime.Il2CppException: System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
--- BEGIN IL2CPP STACK TRACE ---
System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
at UnityEngine.GUILayoutGroup.GetNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, System.Boolean alwaysShowHorizontal, System.Boolean alwaysShowVertical, UnityEngine.GUIStyle horizontalScrollbar, UnityEngine.GUIStyle verticalScrollbar, UnityEngine.GUIStyle background, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
--- END IL2CPP STACK TRACE ---
at Il2CppInterop.Runtime.Il2CppException.RaiseExceptionIfNecessary(IntPtr returnedException) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Runtime/Il2CppException.cs:line 36
at UnityEngine.GUILayout.BeginScrollView(Vector2 scrollPosition, Il2CppReferenceArray`1 options)
at NpcDuelMod.Plugin.OnGUI()
at MelonLoader.MelonEventBase`1.Invoke(Action`1 delegateInvoker) in D:\a\MelonLoader\MelonLoader\MelonLoader\Melons\Events\MelonEvent.cs:line 143
[00:59:33.293] [ERROR] [NPC竞技场] Il2CppInterop.Runtime.Il2CppException: System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
--- BEGIN IL2CPP STACK TRACE ---
System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
at UnityEngine.GUILayoutGroup.GetNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, System.Boolean alwaysShowHorizontal, System.Boolean alwaysShowVertical, UnityEngine.GUIStyle horizontalScrollbar, UnityEngine.GUIStyle verticalScrollbar, UnityEngine.GUIStyle background, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, UnityEngine.GUILayoutOption[] options) [0x00000] in <00000000000000000000000000000000>:0
--- END IL2CPP STACK TRACE ---|
AI反馈:
根据你提供的日志,这个 MOD(NpcDuelMod,即“NPC竞技场”)在运行中触发了 Unity 引擎的一个经典 GUI 布局错误。
错误核心解析
日志中反复报错的核心信息是:
System.ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint1
这个错误发生在 NpcDuelMod.Plugin.OnGUI() 方法中,具体是在调用 GUILayout.BeginScrollView 时1。
产生这个错误的根本原因是:Unity 的 IMGUI 布局系统在同一帧内,绘制(Repaint)的控件数量与之前布局(Layout)阶段计算的控件数量不一致。23
为什么会发生这种情况?
在 Unity 中,OnGUI 方法在一帧内会被多次调用(通常至少包含 Layout 和 Repaint 两次)。
Layout 阶段:Unity 会遍历代码,计算所有 GUILayout 控件的位置和大小,但不实际绘制。
Repaint 阶段:Unity 会根据 Layout 阶段缓存的数据,将控件实际绘制到屏幕上23。
如果在 Layout 阶段,MOD 代码里只创建了 1个 控件(比如因为某个列表为空,或者某个 if 条件不成立),但在 Repaint 阶段,因为某个状态变量发生了改变,导致代码尝试绘制 2个或更多 控件,Unity 就会找不到第 2 个控件的位置缓存,从而抛出 ArgumentException 并中止绘制 |
|