Greetings community !
I wrote code that draws tons of foldouts, depending on Data file information it reads.
Once user clicks and expands an foldout I draw even more controls that read even more data !
That works perfectly!
Problem comes in nature of my for loop and the way you check is an foldout expanded.
Let’s take a look, shall we ? ![]()
for (var xy : int =0; xy <=2; xy++){
if (i >= l_Array.Length){
break;
}
t_ListFoldouts[xy] = EditorGUILayout.Foldout(t_ListFoldouts[xy], l_Array*);*
-
if (t_ListFoldouts[xy]){*
l_Array = EditorGUILayout.TextField(“Sub Entry1 :”, l_Array*);
_ i++;*_
l_Array = EditorGUILayout.TextField(“Sub Entry 2”, l_Array*);
_ i++;*_
l_Array = EditorGUILayout.TextField(“Sub Entry 3”, l_Array*);
var tmpInt : int = parseInt(l_Array);
_ i++;*_
* for (var c = 0; c <= tmpInt-1; c++){*
l_Array = EditorGUILayout.TextField(“Sub Entry 4”, l_Array*);
_ i++;*_
l_Array = EditorGUILayout.TextField(“Sub Entry 5”, l_Array*);
_ i++;*_
* }*
* }*
}
So where is the problem ?
Anything bellow this IF statement :
if (t_ListFoldouts[xy]){
// Code
}
… logically only gets executed if bool is true. In order for bool to be true, user has to expand Foldout.
That doesn’t fit my needs as I write ID of entry in foldout and because of that code all foldouts are the same until user expands each one of them.
Solution to this is to expand all foldouts, but that’s not what I’m after, I want to keep ability to expand them by wish.
Is there some way around this ?
Regards.