public void MakePrefab()
        {
            var prefabCommand = ThisCommand as Command;

            if (MakeStateMachineService.ExistTypeInThisProject(prefabCommand.ServiceName + "StateMachine", out Type stmType) &&
                MakeStateMachineService.ExistTypeInThisProject(prefabCommand.ServiceName + "Installer", out Type installerType))
            {
                var obj  = Resources.Load <GameObject>("StateMachineServiceTemp");
                var game = PrefabUtility.InstantiateAttachedAsset(obj) as GameObject;
                game.AddComponent(stmType);
                game.AddComponent(installerType);

                prefabCommand.Settings.SetFirstStateNodeGameObject(prefabCommand.FirstStateGameObject);

                var nodeList  = game.GetComponent <StateNodeList>();
                var installer = game.GetComponent <Installer>();
                var stm       = game.GetComponent <PaupawsanStateMachine>();

                nodeList.SetStateNodeSettings(prefabCommand.Settings);
                installer.m_prefabSettings = prefabCommand.prefabInstallSettings;
                UnityEventTools.AddObjectPersistentListener(installer.m_onInstalled, new UnityAction <GameObject>(nodeList.Initialize), game);
                UnityEventTools.AddObjectPersistentListener(installer.m_onInstalled, new UnityAction <GameObject>(stm.Initialize), game);

                installer.m_autoInstallHierarchyObject.Add(game);
                installer.m_PrefabRoot = game.transform.GetChild(1);

                EditorUtility.SetDirty(prefabCommand.Settings);
                PrefabUtility.SaveAsPrefabAsset(game, prefabCommand.FilePath + "/" + prefabCommand.ServiceName + "StateMachine.prefab");
                UnityEngine.Object.DestroyImmediate(game);
                AssetDatabase.SaveAssets();
            }
        }
        public void MakePrefab()
        {
            var prefabCommand = ThisCommand as Command;

            foreach (string stateName in prefabCommand.StateNames)
            {
                if (MakeStateMachineService.ExistTypeInThisProject(stateName + "State", out Type type))
                {
                    var obj  = Resources.Load <GameObject>("StateNodeServiceTemp");
                    var game = PrefabUtility.InstantiateAttachedAsset(obj) as GameObject;
                    game.AddComponent(type);

                    var prefab = PrefabUtility.SaveAsPrefabAsset(game, prefabCommand.FilePath + "/" + stateName + "State.prefab");

                    if (prefabCommand.Settings != null)
                    {
                        if (prefabCommand.Settings.StateNodesGameObject == null)
                        {
                            prefabCommand.Settings.SetStateNodesGameObject(new List <GameObject>());
                        }

                        prefabCommand.Settings.StateNodesGameObject.Add(prefab);
                        EditorUtility.SetDirty(prefabCommand.Settings);
                        AssetDatabase.SaveAssets();
                    }

                    UnityEngine.Object.DestroyImmediate(game);
                    AssetDatabase.SaveAssets();
                }
            }
        }