Hello there !
I'm having some troubles making an ingame interface with Unity GUI. Basically, I want to create a small interface to manage a database. Database isn't the problem actually, the problem is Unity GUI itself.
If I have understood the Unity GUI system well, OnGUI() is called twice in a frame : the first time for layouting, the second time for paiting. Sometimes in my script, I refresh the DB view in my GUI which means that the GUI will change. It causes that error : "GUILayout: Mismatched LayoutGroup.Repaint", which seems to be obviously related to the above-mentioned problem.
My question is simple : How can I avoid that problem ? Are there Unity GUI properties that would enable me to know which state the GUI system is currently in ?
Thanks in advance for your answer :)
asked Jul 08, 2012 at 12:10 AM
You can check Event.current.type to see what the EventType is.
answered Jul 08, 2012 at 12:23 AM
change state only at end of frame using coroutines or in layout event. check event in OnGUI in Event.current.type
answered Jun 07, 2013 at 08:36 PM