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 :)
Answer by Eric5h5
Jul 08, 2012 at 12:23 AM
You can check Event.current.type to see what the EventType is.
Answer by Ashkan_gc
Jun 07, 2013 at 08:36 PM
change state only at end of frame using coroutines or in layout event. check event in OnGUI in Event.current.type
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
7 People are following this question.
UnityGUI using Materials instead of Textures
Updating UI in Editor mode while Application is paused
Create a ListView in Unity Android app: use UnityGUI or Android plugin?
Why can't I use Texture2D?
Unity GUI, ScrollView Questions