public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label = null) { if (property[EvaluatorField].Value == null) { // todo -- context should match the decisions context property[EvaluatorField].Value = new Evaluator <EntityContext>(); } GUIRect guiRect = new GUIRect(position); EditorGUIX.PropertyField(guiRect, property[NameField]); EditorGUIX.TypePopup <DecisionContext>(guiRect, EditorGUIX.TempLabel("Context Type"), property[ContextTypeField]); EditorGUIX.PropertyField(guiRect, property[ActionField]); EditorGUIX.PropertyField(guiRect, property[ContextCreatorField]); EditorGUIX.PropertyField(guiRect, property[EvaluatorField]); if (property[ContextTypeField].DidChange) { property.ApplyChanges(); Type newContextType = (Type)property[ContextTypeField].Value; if (!AssertCompatible(property[ActionField], newContextType)) { property[ActionField].Value = null; } if (!AssertCompatible(property[ContextCreatorField], newContextType)) { property[ContextCreatorField].Value = null; } if (!AssertCompatible(property[EvaluatorField], newContextType)) { property[EvaluatorField].SetValueAndCopyCompatibleProperties( EditorReflector.CreateGenericInstance(typeof(Evaluator <>), newContextType) ); // todo -- for each consideration, make sure its compatible with new context type } } }