As the gif shows, this happens when I change foldout’s label in IMGUIContainer.onGUIHandler.
The foldout has only a IMGUIContainer, here’s the code I use to change label text:
private void RefreshTitle()
{
text = ItemModule.GetName(userData.GetType()) + (errorBef ? “(Something)” : string.Empty);
MarkDirtyRepaint();
}
I call this method in ‘onGUIHandler’ callback once the error states change.I don’t know what to do next, it’s this a bug?
Hi!
Whenever you can check/uncheck the foldout, do you do anything particular regarding styles? Even with a bug, I would expect only the foldout itself to go in a broken state and not the whole thing.
Thanks!
I set IMGUIContainer’s style by:
inspector.style.flexGrow = 1;
Is this the reason?But I don’t remember why I write this, lol.And, when that bool property check/uncheck, I will show/hide another property to the right of it, like:
EditorGUI.PropertyField(leftRect, boolProperty);
if (boolProperty.boolValue)
EditorGUI.PropertyField(rightRect, anotherProperty);
It could be, I don’t have enough detail to confirm it.
The IMGUIContainer should be able to size itself from its content, so unless flex-shrink
is set to 1, the defaults should be enough.
I have solved this by registering my RefreshTitle() method to EditorApplication.delayCall instead of invoke it immediately.
So I guess the reason is, when I invoke it immediately, it has conflicts with some internal layout-calculate method and breaks them.
Anyway, thanks for the reply.