//GUI表示 private void OnGUI() { //プレハブにアタッチして保存 if (tempObject != null) { if (SubType.GetType(charaName) != null) { tempObject.AddComponent(typeof(AnimationState)); tempObject.AddComponent(SubType.GetType(charaName)); tempObject.GetComponent <AnimationState>().characterProperty = propertyBuffer; //プレハブのセーブ PrefabUtility.SaveAsPrefabAsset(tempObject, "Assets/Character/" + charaName + "/" + charaName + ".prefab"); tempObject = null; Close(); } } modelObj = EditorGUILayout.ObjectField("キャラクターモデル", modelObj, typeof(GameObject), false) as GameObject; //オブジェクト入力欄の表示 charaName = EditorGUILayout.TextField("キャラ名(半角英字)", charaName); //テキスト入力欄の表示 if (charaName != null) { if (charaName.Length > 0) { charaName = SubString.OneUpper(charaName); //1文字目を大文字に変換 } } //ボタンが押されたときの処理 if (GUILayout.Button("キャラクタ生成")) { if (!Directory.Exists("Assets/Character")) { AssetDatabase.CreateFolder("Assets", "Character"); } CreateScript(); CharacterView.Open(); //CharacterView Scene scene = EditorSceneManager.OpenScene(ConstantsEditor.CHARACTER_VIEW_SCENE_PATH, OpenSceneMode.Additive); //CharacterView用のシーンをロード modelObj = CreatePrefab(scene); //プレハブ、オブジェクト作成 propertyBuffer = CreateParam(); //パラメータ作成 SceneManager.SetActiveScene(scene); //アクティブシーンの変更 } }