查看: 794|回复: 0
打印 上一主题 下一主题

[其他] 添加编辑器窗口的代码

[复制链接]

2317

主题

54

听众

2万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
20645
精华
62

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2014-10-31 19:51:03 |只看该作者 |倒序浏览
  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. }
复制代码
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

关闭

站长推荐上一条 /1 下一条

手机版|纳金网 ( 闽ICP备08008928号

GMT+8, 2024-5-4 09:50 , Processed in 0.083783 second(s), 33 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部