Browse Source

Fixed Flowchart objects break when made into a prefab #275

master
chrisgregan 9 years ago
parent
commit
69dbc5d019
  1. 9
      Assets/Fungus/Flowchart/Editor/BlockEditor.cs
  2. 3
      Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs

9
Assets/Fungus/Flowchart/Editor/BlockEditor.cs

@ -399,6 +399,9 @@ namespace Fungus
newHandler.parentBlock = block; newHandler.parentBlock = block;
block.eventHandler = newHandler; 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) protected virtual void UpdateIndentLevels(Block block)
@ -764,6 +767,9 @@ namespace Fungus
{ {
block.commandList.Add(newCommand); 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() 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(); Repaint();
} }

3
Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs

@ -229,6 +229,9 @@ namespace Fungus
Variable newVariable = flowchart.gameObject.AddComponent(variableType) as Variable; Variable newVariable = flowchart.gameObject.AddComponent(variableType) as Variable;
newVariable.key = flowchart.GetUniqueVariableKey(""); newVariable.key = flowchart.GetUniqueVariableKey("");
flowchart.variables.Add(newVariable); 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<System.Type> FindAllDerivedTypes<T>() public static List<System.Type> FindAllDerivedTypes<T>()

Loading…
Cancel
Save