diff --git a/Assets/Fungus/Scripts/EventHandlers/FlowchartEnabled.cs b/Assets/Fungus/Scripts/EventHandlers/FlowchartEnabled.cs index 50c78d43..4f6dc8f8 100644 --- a/Assets/Fungus/Scripts/EventHandlers/FlowchartEnabled.cs +++ b/Assets/Fungus/Scripts/EventHandlers/FlowchartEnabled.cs @@ -14,8 +14,9 @@ namespace Fungus [AddComponentMenu("")] public class FlowchartEnabled : EventHandler { - protected virtual void OnEnable() + protected override void UnityOnEnable() { + base.UnityOnEnable(); // Blocks use coroutines to schedule command execution, but Unity's coroutines are // sometimes unreliable when enabling / disabling objects. // To workaround this we execute the block on the next frame. diff --git a/Assets/Fungus/Scripts/EventHandlers/GameStarted.cs b/Assets/Fungus/Scripts/EventHandlers/GameStarted.cs index 70d4667e..dd793ec9 100644 --- a/Assets/Fungus/Scripts/EventHandlers/GameStarted.cs +++ b/Assets/Fungus/Scripts/EventHandlers/GameStarted.cs @@ -18,7 +18,13 @@ namespace Fungus [Tooltip("Wait for a number of frames after startup before executing the Block. Can help fix startup order issues.")] [SerializeField] protected int waitForFrames = 1; - protected virtual IEnumerator Start() + protected override void UnityStart() + { + base.UnityStart(); + StartCoroutine(GameStartCoroutine()); + } + + protected virtual IEnumerator GameStartCoroutine() { int frameCount = waitForFrames; while (frameCount > 0)