From a467654c13c4afef9afcee411bd9808a1af363b9 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 14 Aug 2014 12:34:13 +0100 Subject: [PATCH] Undo command expand --- Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs b/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs index fa12c7bb..3834968b 100644 --- a/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs @@ -29,7 +29,13 @@ namespace Fungus.Script GUILayout.BeginHorizontal(); - t.expanded = EditorGUILayout.Foldout(t.expanded, t.GetType().Name); + bool expanded = EditorGUILayout.Foldout(t.expanded, t.GetType().Name); + + if (expanded != t.expanded) + { + Undo.RecordObject(t, "Set Expanded"); + t.expanded = expanded; + } GUIStyle labelStyle = EditorStyles.miniLabel; GUILayout.Label(t.GetDescription().Replace("\n", "").Replace("\r", ""), labelStyle);