private static StateMachine[] FindFsms() { StateMachine[] fsms = UnityEditorUtility.GetAssetsOfType <StateMachine> (".asset"); ICodeBehaviour[] behaviours = UnityEditorUtility.FindInScene <ICodeBehaviour>().ToArray(); fsms = ArrayUtility.AddRange <StateMachine>(fsms, behaviours.Where(x => !EditorUtility.IsPersistent(x.stateMachine)).Select(y => y.stateMachine).ToArray()); return(fsms); }
private void FindFsms() { if (location == Loaction.Project) { fsms = UnityEditorUtility.GetAssetsOfType <StateMachine> (".asset"); } else { ICodeBehaviour[] behaviours = UnityEditorUtility.FindInScene <ICodeBehaviour>().ToArray(); fsms = behaviours.Select(x => x.stateMachine).ToArray(); targets = behaviours.Select(x => x.gameObject).ToArray(); } }
private void SelectGameObject() { if (GUILayout.Button(FsmEditor.ActiveGameObject != null?FsmEditor.ActiveGameObject.name:"[None Selected]", EditorStyles.toolbarDropDown, GUILayout.Width(100))) { GenericMenu toolsMenu = new GenericMenu(); List <ICodeBehaviour> behaviours = UnityEditorUtility.FindInScene <ICodeBehaviour>(); foreach (ICodeBehaviour behaviour in behaviours) { GameObject mGameObject = behaviour.gameObject; toolsMenu.AddItem(new GUIContent(behaviour.name), false, delegate() { FsmEditor.SelectGameObject(mGameObject); }); } toolsMenu.ShowAsContext(); } }