2014年4月28日月曜日

unityで自作ウィンドウを表示する方法

Assetsの中にEditorフォルダを作り中にEditorWindowを継承したクラスを作る。
その際、staticなinit関数を作り、中でWindowの作成を行う
(作成する際にWizardなどを出して編集も可能?)

using UnityEngine;
using System.Collections;
using UnityEditor;


public class ExEditor : EditorWindow
{
 [MenuItem("Window/ExWindow")]
 static void Init()
 {
  ExEditor window = (ExEditor)EditorWindow.GetWindow(typeof(ExEditor));
 }

 void OnGUI()
 {
  EditorGUILayout.LabelField("ExGUI");
 }
}

0 件のコメント: