æ§ã ãªEditorWindow⢠- ScriptableWizard
æ§ã ãªEditorWindowâ¡ - SearchableWIndowã®ç¶ãã§ã
ScriptableWizard
- GameObjectãä½ã
- Prefabãä½ã
- ãã®ä»ã¢ã»ãããä½ã
ä½ãããä½ããæã«ä½¿ç¨ããWindowã§ãã
OnGUIã¯ä½¿ããªã
ScriptableWizardã§ã¯EditorWindowãç¶æ¿ãã¦ããã®ã§OnGUIã使ç¨åºæ¥ã¾ãã
OnGUIã使ç¨ããã¨Createãã¿ã³ã¨Otherãã¿ã³ã表示ãããªããªã£ã¦ãã¾ãã¾ãã ã¤ã¾ããã ã®EditorWindowã«ãªã£ã¦ãã¾ãã¾ãã
ScriptableWizardã«è¡¨ç¤ºããããã®ã¯SerializedProperty
ç°¡åã«ããã°ãScriptableWizardã«è¡¨ç¤ºããããã®ã¯Inspectorã«è¡¨ç¤ºããããããªpublicãªå¤æ°ã
ãµã³ãã«: Prefabãä½æãã¦ã¤ã³ã¹ã¿ã³ã¹åãã
using UnityEngine; using System.Collections; using UnityEditor; public class Hoge : ScriptableWizard { public string objectName = string.Empty; [MenuItem("GameObject/Create Object")] static void CreateWizard () { ScriptableWizard.DisplayWizard<Hoge> ("Create Object", "Create"); } void OnWizardCreate () { GameObject obj = new GameObject (ObjectNames.NicifyVariableName (objectName), typeof(BoxCollider)); Object prefab = PrefabUtility.CreatePrefab (string.Format ("Assets/{0}.prefab", obj.name), obj); DestroyImmediate (obj); PrefabUtility.InstantiatePrefab (prefab); } void OnWizardUpdate () { //æ¡ä»¶æºããã¾ã§Createãã¿ã³æ¼ããªã isValid = !string.IsNullOrEmpty (objectName); } }