自定义Unity菜单
来源:互联网 发布:nginx check module 编辑:程序博客网 时间:2024/05/21 10:04
今天我们制作自定义Unity菜单。不多说,直接上代码:
using UnityEditor;
using UnityEngine;public class Menu
{
[MenuItem("YouyouTools/Settings")]
public static void Settings()
{
SettingsWindow win = (SettingsWindow)EditorWindow.GetWindow(typeof(SettingsWindow));
win.titleContent = new GUIContent("标题");
win.Show();
}
}
恩,自定义菜单成功。
接下来在弹框中,制作内容:
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class SettingsWindow : EditorWindow
{
private string danXuan= "danXuan";
string myString = "Hello World";
bool groupEnabled;
bool myBool = true;
float myFloat = 1.23f;
private void OnGUI()
{
//开启一行
EditorGUILayout.BeginHorizontal("box");
danXuan = GUILayout.Toggle("danXuan", danXuan);//制作单选框
//结束一行
EditorGUILayout.EndHorizontal();
GUILayout.Label("Base Settings", EditorStyles.boldLabel);
myString = EditorGUILayout.TextField("Text Field", myString);
groupEnabled = EditorGUILayout.BeginToggleGroup("Optional Settings", groupEnabled);
myBool = EditorGUILayout.Toggle("Toggle", myBool);
myFloat = EditorGUILayout.Slider("Slider", myFloat, -3, 3);
EditorGUILayout.EndToggleGroup();
}
}
- 自定义Unity菜单
- 为unity添加自定义菜单
- Unity菜单自定义功能介绍
- unity indicator下菜单自定义的解决方法
- Unity UGUI自定义树形菜单(TreeView)
- Unity UGUI自定义树形菜单(TreeView)
- Unity自定义创建脚本模板菜单
- 在Unity菜单栏上添加自定义菜单
- Unity菜单编程-自定义的图片Inspector面板
- 【Unity编辑器】使用反射和Attribute实现自定义右键菜单
- Unity 使用自定义资源(.asset) 添加 Assets 菜单按钮二
- 自定义菜单
- 自定义菜单
- 自定义菜单
- 自定义菜单
- 自定义菜单
- 自定义菜单
- 自定义菜单
- Lua笔记-关于lua table的C API
- 树状数组 ( Binary Indexed Tree,BIT,二分索引树 )
- 计算机网络体系之混合模型之数据链路层
- Google神秘实验室里,诞生了哪些有趣玩意儿?
- Linux动态库生成与使用指南
- 自定义Unity菜单
- 自适应 响应式 流式的区别
- python 递归
- Linux命令行安装weblogic
- Python-在Python2中使用Python3的输出和除法格式
- android简单的实现数据库增删改查
- hw_module_t 加载过程
- 机器学习-第二周-第一次作业 numpy基础
- viewpager+fragment