From 69dbc5d0197f4e1eb81d8c9c0aac3771fd806c8d Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 8 Oct 2015 16:24:47 +0100 Subject: [PATCH] Fixed Flowchart objects break when made into a prefab #275 --- Assets/Fungus/Flowchart/Editor/BlockEditor.cs | 9 +++++++++ Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs | 3 +++ 2 files changed, 12 insertions(+) diff --git a/Assets/Fungus/Flowchart/Editor/BlockEditor.cs b/Assets/Fungus/Flowchart/Editor/BlockEditor.cs index 4689de23..e1cb01f8 100644 --- a/Assets/Fungus/Flowchart/Editor/BlockEditor.cs +++ b/Assets/Fungus/Flowchart/Editor/BlockEditor.cs @@ -399,6 +399,9 @@ namespace Fungus newHandler.parentBlock = block; block.eventHandler = newHandler; } + + // Because this is an async call, we need to force prefab instances to record changes + PrefabUtility.RecordPrefabInstancePropertyModifications(block); } protected virtual void UpdateIndentLevels(Block block) @@ -764,6 +767,9 @@ namespace Fungus { block.commandList.Add(newCommand); } + + // Because this is an async call, we need to force prefab instances to record changes + PrefabUtility.RecordPrefabInstancePropertyModifications(block); } public virtual void ShowContextMenu() @@ -968,6 +974,9 @@ namespace Fungus } } + // Because this is an async call, we need to force prefab instances to record changes + PrefabUtility.RecordPrefabInstancePropertyModifications(block); + Repaint(); } diff --git a/Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs b/Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs index 77207e5d..c509c15c 100644 --- a/Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs +++ b/Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs @@ -229,6 +229,9 @@ namespace Fungus Variable newVariable = flowchart.gameObject.AddComponent(variableType) as Variable; newVariable.key = flowchart.GetUniqueVariableKey(""); flowchart.variables.Add(newVariable); + + // Because this is an async call, we need to force prefab instances to record changes + PrefabUtility.RecordPrefabInstancePropertyModifications(flowchart); } public static List FindAllDerivedTypes()