Is it possible to have a window generated by pressing a button (from a set of buttons which produces only one window at a time) inside a generated window?
I can’t find a way to get this to work. Sometimes some of the buttons create a window, while other times they just don’t work.
I have created a unity package with a minimalistic test scene where this problem occurs. You can download it here:
http://feupload.fe.up.pt/get/MhGJhplt45EjkFP
EDIT - Example 2: I have just reduced this to the simplest case possible, a window inside a window. This correctly renders both of the windows, but it still shows a runtime error on the console. I suppose Unity can’t handle Windows inside Windows.
using UnityEngine;
public class Test : MonoBehaviour {
void OnGUI() { GUILayout.Window(0, new Rect(0, 0, 200, 300), OnGUIWindow, "Parent"); } void OnGUIWindow(int windowID) { GUILayout.Label("Parent"); GUILayout.Window(1, new Rect(0, 0, 100, 150), drawWindow, "Son"); } void drawWindow(int windowID) { GUILayout.Label("Son"); }
}
Errors:
InvalidOperationException: Hashtable.Enumerator: snapshot out of sync.
ArgumentException: Getting control 0’s position in a group with only 0 controls when doing Repaint