From 29d64759021311d438c8c207e72cf5b1ff40fc01 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 25 Sep 2014 20:29:41 +0100 Subject: [PATCH] Create Sequence adds to right side of selected Sequence --- .../FungusScript/Editor/FungusScriptWindow.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs b/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs index ce679e1a..a10081ef 100755 --- a/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs +++ b/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs @@ -211,7 +211,18 @@ namespace Fungus if (GUILayout.Button(fungusScript.selectedSequence == null ? "Create Sequence" : "Create", fungusScript.selectedSequence == null ? EditorStyles.miniButton : EditorStyles.miniButtonLeft)) { - CreateSequence(fungusScript, fungusScript.scriptScrollPos); + Vector2 newPosition; + if (fungusScript.selectedSequence == null) + { + newPosition = fungusScript.scriptScrollPos; + } + else + { + Rect selectedRect = fungusScript.selectedSequence.nodeRect; + newPosition = new Vector2(selectedRect.position.x + selectedRect.width + 20, selectedRect.y); + } + + CreateSequence(fungusScript, newPosition); } if (fungusScript.selectedSequence == null)