Hey guys!
I have an object with some components on it.
I wish to fold off (collapse) all component’s properties on selected object.
I have a button in the EditorWindow which runs this code:
Component[] components = go.GetComponents<Component>();
foreach (Component component in components)
{
SerializedObject so = new SerializedObject(component);
SerializedProperty iterator = so.GetIterator();
do
{
iterator.isExpanded = false;
}
while (iterator.NextVisible(true));
so.ApplyModifiedProperties();
EditorUtility.SetDirty(component);
}
EditorUtility.SetDirty(go);
go - is a selected object.
Code does job I need. But for the some reason I can see changes only if I deselect and re-select that object again.
Both
AssetDatabase.Refresh();
and
InternalEditorUtility.RepaintAllViews()
doesn’t help here.
Am I missing something obvious (I bet I do)?
Thanks!
"But for the some reason I can see changes only if I deselect and re-select that object again." This symptom makes me want to see the code where you set the gameObject reference
– Fullblowngo
.Also, Editor class itself has http://docs.unity3d.com/ScriptReference/Editor.Repaint.html did you try:
– Fullblownthis.Repaint()
yet?