In the beginning,when I tried calling GUILayout.xxx when Event.current.type == EventType.Repaint , Unity logs errors:
ArgumentException: Getting control 0’s position in a group with only 0 controls when doing Repaint
Aborting
Then I tried calling GUILayout.Button in random frame, the same errors will occur.
It is strange that GUIStyle.Draw() must be called when Event.current.type == EventType.Repaint but GUILayout.xxx cannot be called at the same time. ![]()
How does GUILayout.xxx work in low level?