Browse Source

Fixed memory leak and null exception errors

master
chrisgregan 11 years ago
parent
commit
a25b61fc0d
  1. 6
      Assets/Fungus/Dialog/Editor/ChooseEditor.cs
  2. 6
      Assets/Fungus/Dialog/Editor/SayEditor.cs
  3. 1
      Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs
  4. 5
      Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs

6
Assets/Fungus/Dialog/Editor/ChooseEditor.cs

@ -58,10 +58,8 @@ namespace Fungus
float aspect = (float)characterTexture.width / (float)characterTexture.height;
Rect previewRect = GUILayoutUtility.GetAspectRect(aspect, GUILayout.Width(50), GUILayout.ExpandWidth(false));
CharacterEditor characterEditor = Editor.CreateEditor(t.character) as CharacterEditor;
if (characterEditor != null)
{
characterEditor.DrawPreview(previewRect, characterTexture);
}
characterEditor.DrawPreview(previewRect, characterTexture);
DestroyImmediate(characterEditor);
}
EditorGUILayout.EndHorizontal();

6
Assets/Fungus/Dialog/Editor/SayEditor.cs

@ -75,10 +75,8 @@ namespace Fungus
float aspect = (float)characterTexture.width / (float)characterTexture.height;
Rect previewRect = GUILayoutUtility.GetAspectRect(aspect, GUILayout.Width(50), GUILayout.ExpandWidth(false));
CharacterEditor characterEditor = Editor.CreateEditor(t.character) as CharacterEditor;
if (characterEditor != null)
{
characterEditor.DrawPreview(previewRect, characterTexture);
}
characterEditor.DrawPreview(previewRect, characterTexture);
DestroyImmediate(characterEditor);
}
EditorGUILayout.EndHorizontal();

1
Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs

@ -89,6 +89,7 @@ namespace Fungus
{
CommandEditor commandEditor = Editor.CreateEditor(t.selectedCommand) as CommandEditor;
commandEditor.DrawCommandInspectorGUI();
DestroyImmediate(commandEditor);
}
EditorGUILayout.Separator();

5
Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs

@ -269,8 +269,9 @@ namespace Fungus
{
EditorGUILayout.Separator();
SequenceEditor editor = Editor.CreateEditor(fungusScript.selectedSequence) as SequenceEditor;
editor.DrawSequenceGUI(fungusScript);
SequenceEditor sequenceEditor = Editor.CreateEditor(fungusScript.selectedSequence) as SequenceEditor;
sequenceEditor.DrawSequenceGUI(fungusScript);
DestroyImmediate(sequenceEditor);
GUILayout.FlexibleSpace();
}

Loading…
Cancel
Save