diff --git a/Assets/Fungus/FungusScript/Editor/FungusScriptMenuItems.cs b/Assets/Fungus/FungusScript/Editor/FungusScriptMenuItems.cs index 1e1b62c2..f6a2b793 100644 --- a/Assets/Fungus/FungusScript/Editor/FungusScriptMenuItems.cs +++ b/Assets/Fungus/FungusScript/Editor/FungusScriptMenuItems.cs @@ -14,9 +14,8 @@ namespace Fungus newFungusScriptGO.name = "FungusScript"; FungusScript fungusScript = newFungusScriptGO.AddComponent(); Sequence sequence = Undo.AddComponent(newFungusScriptGO); - sequence.nodeRect.x += 50; - sequence.nodeRect.y += 50; - sequence.nodeRect.width = 240; + sequence.nodeRect.x += 60; + sequence.nodeRect.y += 60; fungusScript.startSequence = sequence; fungusScript.selectedSequence = sequence; fungusScript.scrollPos = Vector2.zero; diff --git a/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs b/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs index 036fddd5..d337f98f 100755 --- a/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs +++ b/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs @@ -209,7 +209,6 @@ namespace Fungus Rect windowRect = new Rect(sequence.nodeRect); windowRect.x += fungusScript.scrollPos.x; windowRect.y += fungusScript.scrollPos.y; - windowRect.width = 240; GUILayout.Window(i, windowRect, DrawWindow, "", windowStyle); @@ -373,7 +372,6 @@ namespace Fungus Undo.RegisterCreatedObjectUndo(newSequence, "New Sequence"); fungusScript.selectedSequence = newSequence; fungusScript.ClearSelectedCommands(); - newSequence.nodeRect.width = 240; return newSequence; } diff --git a/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs b/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs index 56abefc6..e7f892c8 100644 --- a/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs +++ b/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs @@ -26,8 +26,18 @@ namespace Fungus // We acquire the serialized properties in the draw methods instead of in OnEnable as otherwise // deleting or renaming a command class would generate a bunch of null reference exceptions. SerializedProperty sequenceNameProp = serializedObject.FindProperty("sequenceName"); - EditorGUILayout.PropertyField(sequenceNameProp); + + SerializedProperty nodeRectProp = serializedObject.FindProperty("nodeRect"); + EditorGUI.BeginChangeCheck(); + float width = EditorGUILayout.FloatField(new GUIContent("Node Width"), nodeRectProp.rectValue.width); + if (EditorGUI.EndChangeCheck()) + { + Rect nodeRect = nodeRectProp.rectValue; + nodeRect.width = Mathf.Max(width, 100); + nodeRectProp.rectValue = nodeRect; + } + EditorGUILayout.Separator(); serializedObject.ApplyModifiedProperties(); @@ -40,8 +50,6 @@ namespace Fungus Sequence sequence = target as Sequence; UpdateIndentLevels(sequence); - sequence.nodeRect.width = 240; - SerializedProperty commandListProperty = serializedObject.FindProperty("commandList"); ReorderableListGUI.Title(sequence.sequenceName); diff --git a/Assets/Fungus/FungusScript/Scripts/Node.cs b/Assets/Fungus/FungusScript/Scripts/Node.cs index 8ce862c8..67668c24 100644 --- a/Assets/Fungus/FungusScript/Scripts/Node.cs +++ b/Assets/Fungus/FungusScript/Scripts/Node.cs @@ -6,7 +6,7 @@ namespace Fungus public class Node : MonoBehaviour { - public Rect nodeRect = new Rect(10, 10, 100, 20); + public Rect nodeRect = new Rect(0, 0, 240, 20); } } \ No newline at end of file