Browse Source

replaced say dropdown menu with object picker

master
Timothy Ng 9 years ago
parent
commit
74c14f5985
  1. 4
      Assets/Fungus/Flowchart/Editor/CommandEditor.cs
  2. 5
      Assets/Fungus/Narrative/Editor/SayEditor.cs

4
Assets/Fungus/Flowchart/Editor/CommandEditor.cs

@ -154,6 +154,7 @@ namespace Fungus
serializedObject.ApplyModifiedProperties();
}
static public void ObjectField<T>(SerializedProperty property, GUIContent label, GUIContent nullLabel, List<T> objectList) where T : Object
{
if (property == null)
@ -172,10 +173,12 @@ namespace Fungus
if (objectList[i] == null) continue;
objectNames.Add(new GUIContent(objectList[i].name));
if (selectedObject == objectList[i])
{
selectedIndex = i + 1;
}
}
T result;
@ -193,6 +196,7 @@ namespace Fungus
property.objectReferenceValue = result;
}
/**
* When modifying custom editor code you can occasionally end up with orphaned editor instances.
* When this happens, you'll get a null exception error every time the scene serializes / deserialized.

5
Assets/Fungus/Narrative/Editor/SayEditor.cs

@ -118,10 +118,7 @@ namespace Fungus
bool showPortraits = false;
CommandEditor.ObjectField<Character>(characterProp,
new GUIContent("Character", "Character that is speaking"),
new GUIContent("<None>"),
Character.activeCharacters);
characterProp.objectReferenceValue = (Character) EditorGUILayout.ObjectField(characterProp.objectReferenceValue, typeof(Character), true);
Say t = target as Say;

Loading…
Cancel
Save