I’m having an issue with CustomEditor’s not actually showing.
I have a controller (MonoBehaviour) that has an array of Interaction attached to it. The Interaction class looks like:
[Serializable]
public class Interaction
{
public ConditionContainer[] Conditions;
}
ConditionContainer is a way to wrap up and instantiate actual Conditions for an Interaction to occur (i.e. bumped into, press a key, etc).
[Serializable]
public class ConditionContainer : ScriptableObject
{
public ConditionType ConditionType;
public Condition Condition;
public bool IsMet()
{
if( Condition != null )
{
return Condition.IsMet();
}
return true;
}
}
Condition itself is an abstract class and I was planning on instantiating it in my CustomEditor, based on the ConditionType that was set, and having CustomEditor’s for each specific Condition (i.e. BumpedIntoCondition, PressedKeyCondition).
[Serializable]
public abstract class Condition
{
public ConditionType ConditionType;
public virtual bool IsMet()
{
return true;
}
}
My CustomEditor’s NEVER display or work. I don’t know if it’s because they don’t play well with arrays or if I’m missing some kind of derivation or attribute or what.
Just trying to output a label that says “Hello World” fails…
[CustomEditor(typeof(ConditionContainer), true)]
[CanEditMultipleObjects]
public class ConditionContainerEditor : Editor
{
public override void OnInspectorGUI()
{
//serializedObject.Update();
EditorGUILayout.LabelField("Hello World");
//serializedObject.ApplyModifiedProperties();
}
}
Am I missing something? I’ve commented out the serializedObject details, but they don’t make a difference either way. I’ve tried calling into the base.OnInspectorGUI() as well… No luck anywhere. The Editor itself is inside Assets\Editor – when I open the code, it tosses it into another C# Project called “Editors” so I assume it’s recognizing.
I’m using Unity 2017.3 Personal.