Browse Source

Try Catch around VarListLayout so we can eat the error that occurs when moving from play back to edit

master
desktop-maesty/steve 7 years ago
parent
commit
17cd4cde4e
  1. 10
      Assets/Fungus/Scripts/Editor/FlowchartWindow.cs
  2. 10
      Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs

10
Assets/Fungus/Scripts/Editor/FlowchartWindow.cs

@ -514,11 +514,15 @@ namespace Fungus.EditorUtils
if (variableListAdaptor != null) if (variableListAdaptor != null)
{ {
if (variableListAdaptor.TargetFlowchart == null) if (variableListAdaptor.TargetFlowchart != null)
variableListAdaptor = null; {
else
variableListAdaptor.DrawVarList(0); variableListAdaptor.DrawVarList(0);
} }
else
{
variableListAdaptor = null;
}
}
if(EditorGUI.EndChangeCheck()) if(EditorGUI.EndChangeCheck())
{ {

10
Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs

@ -138,6 +138,12 @@ namespace Fungus.EditorUtils
public void DrawVarList(int w) public void DrawVarList(int w)
{ {
//we want to eat the throw that occurs when switching back to editor from play
try
{
if (_arrayProperty == null || _arrayProperty.serializedObject == null)
return;
_arrayProperty.serializedObject.Update(); _arrayProperty.serializedObject.Update();
this.widthOfList = (w == 0 ? VariableListAdaptor.DefaultWidth : w) - ScrollSpacer; this.widthOfList = (w == 0 ? VariableListAdaptor.DefaultWidth : w) - ScrollSpacer;
@ -152,6 +158,10 @@ namespace Fungus.EditorUtils
} }
_arrayProperty.serializedObject.ApplyModifiedProperties(); _arrayProperty.serializedObject.ApplyModifiedProperties();
} }
catch (Exception)
{
}
}
public void DrawItem(Rect position, int index, bool selected, bool focused) public void DrawItem(Rect position, int index, bool selected, bool focused)
{ {

Loading…
Cancel
Save