public override void OnOpen() { if (assignmentType.enumValueIndex == 0) // Constant value, we have all we need, just create the editor { _editor = UnityEditor.Editor.CreateEditor(constantValue.objectReferenceValue); } else if (assignmentType.enumValueIndex == 1) // Global. Pretty easy, just get the global variable object and cast it to GameVariable<T> { _gameVariable = globalVariable.objectReferenceValue as GameVariable <T>; if (_gameVariable != null) { _editor = UnityEditor.Editor.CreateEditor(_gameVariable); } else { _runtimeSet = globalVariable.objectReferenceValue as RuntimeSet <T>; if (_runtimeSet != null) { _editor = UnityEditor.Editor.CreateEditor(_runtimeSet); } else { _noReference = true; } } } else if (assignmentType.enumValueIndex == 2) // instanced { var variable = instancedVariable.objectReferenceValue as InstancedVariable <T>; if (variable != null) { var token = (idTokenHolder.objectReferenceValue as IDTokenHolder)?.IDToken; _gameVariable = variable.GetVariable(token); _editor = UnityEditor.Editor.CreateEditor(_gameVariable); } else { var list = instancedVariable.objectReferenceValue as InstancedList <T>; if (list != null) { var token = (idTokenHolder.objectReferenceValue as IDTokenHolder)?.IDToken; _runtimeSet = list.GetList(token); _editor = UnityEditor.Editor.CreateEditor(_runtimeSet); } else { _noReference = true; } } } base.OnOpen(); }
private void OnDisable() { RuntimeSet.Remove(RuntimesetType); }
public void OnEnable() { RuntimeSet.Add(RuntimesetType); }