From 0a0d53284d614d0635b861bf1b9d6b8e3f48c649 Mon Sep 17 00:00:00 2001 From: Brian Dean Jennings Date: Thu, 9 Jul 2015 11:38:31 -0700 Subject: [PATCH] Additional flowcharts added to the scene no longer have their initial block start with the default 'Game Started' event. --- Assets/Fungus/Flowchart/Scripts/Flowchart.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs index a16dda50..8dfb795a 100644 --- a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs @@ -261,6 +261,12 @@ namespace Fungus protected virtual void Initialize() { + // If there are other flowcharts in the scene and the selected block has the default name, then this is probably a new block. + // Reset the event handler of the new flowchart's default block to avoid crashes. + if (selectedBlock && cachedFlowcharts.Count > 1 && selectedBlock.name == "New Block") + { + selectedBlock.eventHandler = null; + } } protected virtual Block CreateBlockComponent(GameObject parent)