protected void OnEnable() { // State machine behaviour smb = target as ToryCustomSceneSMB; // Serialzed properties next = serializedObject.FindProperty("next"); forcedStayTimeSinceStarted = serializedObject.FindProperty("forcedStayTimeSinceStarted"); interactionCheckTime = serializedObject.FindProperty("interactionCheckTime"); autoLoadOnPlayerLeft = serializedObject.FindProperty("autoLoadOnPlayerLeft"); transitionTime = serializedObject.FindProperty("transitionTime"); autoProceedOnTransition = serializedObject.FindProperty("autoProceedOnTransition"); stepCount = serializedObject.FindProperty("stepCount"); // Access to the selected state or state machine in animator controller. // Ref.: https://docs.unity3d.com/ScriptReference/Selection.html // Ref.: https://docs.unity3d.com/ScriptReference/Animations.AnimatorController.html s = Selection.activeObject as AnimatorState; sm = Selection.activeObject as AnimatorStateMachine; // Find the animator controller of this state machine behavior belongs. // Ref.: https://forum.unity.com/threads/get-animator-in-editor-mode.461838/ //EditorWindow w = EditorWindow.focusedWindow; //System.Type type = w.GetType(); //PropertyInfo prop = type.GetProperty("animatorController", (BindingFlags.NonPublic | // BindingFlags.Public | // BindingFlags.Instance)); //if (prop != null) //{ // ac = prop.GetValue(w, null) as AnimatorController; //} }
protected void Init(ToryCustomSceneSMB smb) { if (smb == null) { this.smb = ScriptableObject.CreateInstance <ToryNullSceneSMB>(); } else { this.smb = smb; } // Set the Next. SetNext(); // Declared in the partial class. // Tory events. ToryScene.Instance.Loaded += OnSceneLoaded; }