纳金网

标题: Unity3d添加编辑器窗口 [打印本页]

作者: 狂风大尉    时间: 2014-6-25 01:18
标题: Unity3d添加编辑器窗口
  1. using UnityEngine;
  2. using UnityEditor;
  3. public class MyWindow : EditorWindow
  4. {
  5.     // Add menu named "My Window" to the Window menu
  6.     [MenuItem ("Window/My Window")]
  7.     static void Init () {
  8.     // Get existing open window or if none, make a new one:
  9.      MyWindow window = (MyWindow)EditorWindow.GetWindow (typeof (MyWindow));
  10.      void OnGUI ()
  11.     {//Unity3D:www.unitymanual.com
  12.         GUILayout.Label ("Base Settings", EditorStyles.boldLabel);myString
  13.         EditorGUILayout.TextField ("Text Field", myString);groupEnabled
  14.         EditorGUILayout.BeginToggleGroup ("Optional Settings", groupEnabled);
  15.         myBool = EditorGUILayout.Toggle ("Toggle", myBool);
  16.         myFloat = EditorGUILayout.Slider ("Slider", myFloat, -3, 3);
  17.         EditorGUILayout.EndToggleGroup ();
  18.         EditorGUIUtility.LookLikeInspector ();
  19.         EditorGUILayout.TextField ("Text Field:", "Hello There");
  20.         EditorGUILayout.IntField("Int Field:", integer1);
  21.         EditorGUILayout.FloatField("Float Field:", float1);
  22.         EditorGUILayout.Space();
  23.         EditorGUIUtility.LookLikeControls();
  24.         EditorGUILayout.TextField ("Text Field", "Hello There");
  25.         EditorGUILayout.IntField("Int Field:", integer1);
  26.         EditorGUILayout.FloatField("Float Field:", float1);
  27.     }
  28. }
复制代码
* 版权声明:转载时请以超链接形式标明文章原始出处和作者信息
* 本文来自:Unity3D教程手册
* 本文链接:http://www.unitymanual.com/7092.html

作者: hyui    时间: 2014-6-25 02:24
Thanks for sharing this!
作者: wucnj    时间: 2014-6-25 09:03
感谢分享!!!
作者: hariboot    时间: 2014-6-25 09:05

Thanks for sharing this!
作者: HIDEOKOJIMA    时间: 2014-6-25 16:51
感谢分享!




欢迎光临 纳金网 (http://rs.narkii.com/club/) Powered by Discuz! X2.5