diff --git a/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs b/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs index 6baab06f..5e7451c2 100644 --- a/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs @@ -25,6 +25,11 @@ namespace Fungus.Script { FungusCommand t = target as FungusCommand; + if (t == null) + { + return; + } + GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); @@ -44,74 +49,63 @@ namespace Fungus.Script GUILayout.EndHorizontal(); - if (!t.expanded) + if (t.expanded) { - GUILayout.EndVertical(); - if (Event.current.type == EventType.Repaint && - t.IsExecuting()) - { - Rect rect = GUILayoutUtility.GetLastRect(); - rect.x -= 10; - rect.width += 10; - GLDraw.DrawBox(rect, Color.green, 1.5f); - } - return; - } + GUILayout.BeginHorizontal(); - GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); - GUILayout.FlexibleSpace(); - - if (GUILayout.Button("Up", EditorStyles.miniButtonLeft)) - { - UnityEditorInternal.ComponentUtility.MoveComponentUp(t); - } - if (GUILayout.Button("Down", EditorStyles.miniButtonMid)) - { - UnityEditorInternal.ComponentUtility.MoveComponentDown(t); - } - - FungusScript fungusScript = t.GetFungusScript(); - - if (fungusScript != null) - { - if (GUILayout.Button("Copy", EditorStyles.miniButtonMid)) + if (GUILayout.Button("Up", EditorStyles.miniButtonLeft)) + { + UnityEditorInternal.ComponentUtility.MoveComponentUp(t); + } + if (GUILayout.Button("Down", EditorStyles.miniButtonMid)) { - fungusScript.copyCommand = t; + UnityEditorInternal.ComponentUtility.MoveComponentDown(t); } - if (fungusScript.copyCommand != null) + FungusScript fungusScript = t.GetFungusScript(); + + if (fungusScript != null) { - if (GUILayout.Button("Paste", EditorStyles.miniButtonMid)) + if (GUILayout.Button("Copy", EditorStyles.miniButtonMid)) { - CopyComponent(fungusScript.copyCommand, t.gameObject); + fungusScript.copyCommand = t; + } + + if (fungusScript.copyCommand != null) + { + if (GUILayout.Button("Paste", EditorStyles.miniButtonMid)) + { + CopyComponent(fungusScript.copyCommand, t.gameObject); + } } } - } - - if (GUILayout.Button("Delete", EditorStyles.miniButtonRight)) - { - Undo.DestroyObjectImmediate(t); - return; - } + + if (GUILayout.Button("Delete", EditorStyles.miniButtonRight)) + { + Undo.DestroyObjectImmediate(t); + return; + } - GUILayout.FlexibleSpace(); + GUILayout.FlexibleSpace(); - GUILayout.EndHorizontal(); + GUILayout.EndHorizontal(); - EditorGUILayout.Separator(); + EditorGUILayout.Separator(); - DrawCommandGUI(); + DrawCommandGUI(); - EditorGUILayout.Separator(); + EditorGUILayout.Separator(); - if (t != null) - { - if (t.errorMessage.Length > 0) + if (t != null) { - GUIStyle style = new GUIStyle(GUI.skin.label); - style.normal.textColor = new Color(1,0,0); - EditorGUILayout.LabelField(new GUIContent("Error: " + t.errorMessage), style); + if (t.errorMessage.Length > 0) + { + GUIStyle style = new GUIStyle(GUI.skin.label); + style.normal.textColor = new Color(1,0,0); + EditorGUILayout.LabelField(new GUIContent("Error: " + t.errorMessage), style); + } } } diff --git a/Assets/Fungus/VisualScripting/Call.cs b/Assets/Fungus/VisualScripting/Call.cs index 4d522945..fb2866ff 100644 --- a/Assets/Fungus/VisualScripting/Call.cs +++ b/Assets/Fungus/VisualScripting/Call.cs @@ -190,6 +190,11 @@ namespace Fungus.Script { if (callCondition == CallCondition.CallAlways) { + if (targetSequence == null) + { + return "No target sequence selected"; + } + return targetSequence.name; } else diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index 892b851a..60506a40 100644 Binary files a/Assets/Shuttle/ShuttleGame.unity and b/Assets/Shuttle/ShuttleGame.unity differ