Need help with this error please

I get the following error sometimes
I try to reproduce it through my game but it seems I don’t know exactly what causes it , as sometimes it happens and other time it doesn’t happen even though I do the same steps that made it happen

lol alot of “happen” words … . anyway

here is the main error label

ArgumentException : Getting control 0's position in a group with only 0 controls when doing Repaint
Aborting

about the error description , it is too large so it will be ugly to paste it here , so I will paste it in a text file and attatch it in the post if anyway can figure out the problem from it

I think it is something about my GUI’s functions , as I have alot of windows
but I rechecked every window ID and each window have its own unique one
and no more than 1 GUI.BringWindowToFront function call at the same time
and thats all I have thought about to figure it out and still I get this error sometimes

check the attatchements
634114–22666–$ErrorDetails.txt (1.44 KB)

It may be an issue with GUILayout.BeginHorizontal/BeginVertical that are not ended…

The only GUILayout expression I used so far is

        selectedGrid = GUILayout.SelectionGrid(selectedGrid, slots, 5, GUILayout.Height(secondWindowHeight));

and I didn’t use GUILayout.BeginHorizontal/BeginVertical at all
could this be the problem ?

I sux at GUI’s sry

Hm, do you use a GUILayoutUtility function, like GetLastRect or GetRect ?
It can only be done within a Repaint event type :

if(Event.current.type == EventType.Repaint)
m_lastRect = GUILayoutUtility.GetLastRect();

I think it’s a bug, i’ve been having it also but can’t reproduce it

Nope I don’t use any of these , I don’t even know what are those yet , I’m learning as I go

@ appels hmm… are you sure ? we need more ppl to confirm this then to send it to devs

by the way , I get all my windows and controls painted even though I get this message , so this message don’t affect my game or any GUI’s on it or thier functionality

will let you know if this happens after I build the game and it still not affect the game though I will not know if it happens and my game still works fine in the built

same here, gui draws everything, just get the error sometimes

What’s your slot var. Is it of type string[ ]/Texture[ ]/GUIContent[ ]? Maybe try a reimport so that it can compile the scripts properly.

the slot is a string[ ] so no import , but yeah you gave me an idea now as it is still null may be , the array have a length but none of its members have a value yet , it gets the values from the game progress , I’ll check that
thanks

Nope eventhough I set the values of the string array I still get the error
I get it more now , it seems this error happens on the first call for the gui after launching the game and never repeat again later

any clues yet ?

Yes. Set selected grid to -1 at the start.

var selectedGrid : int = -1;

Well I’ve set selectedGrid to -1 and I still getting the same error

well I got rid of this error by completely remove the GUILayout , I hate GUILayout and don’t know exactly how they work , reading the scripting reference and manual didn’t help much to figure it out completely so I used GUI and no errors at all

Maybe try the new version of Unity. Might have fixed that. :smile:

huh ? there is a new version ?
OMG they just released a new version now !!
ty

Yeap. 3.4 just got released last nite. According to my time. :smile: Have fun.

This happens when you call a Loop inbetween GUILayout.BeginScrollView. I’m actually getting it right now. Haven’t found any fixes as of yet.

scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(sX), GUILayout.Height(sY));
		
		for(int i = 0; i < PlayerData.instance.Skill.Length; i++)
		{
			GUILayout.Label ( PlayerData.instance.Skill[i].Name + ": "  + PlayerData.instance.Skill[i].CurrentSkill + "\tTil Gain: " + (int)PlayerData.instance.Skill[i].CurrentCount +" / " + (int)PlayerData.instance.Skill[i].gainNeeded() );
		}
		
		GUILayout.EndScrollView();

Edit** - I actually ending up working around mine since I was merly trying to extend the scrollbar as far as my skills needed to go. So I simply counted Enumerated Skills and multipled it by a line offset number.