第三节 高级的控件 Checkbox单选和多选、dropdownlis下拉列表、listbox列表框、progressbar进度条、richtextlabel富文本、slider滑块、textbox输入框、scrollbar滚动条。 3.1、Checkbox单选和多选 先来显示如下的内容: 设置如下: Checked 表示当前是否选中的状态;。 Text的内容是Label对象的内容自动获取的, 为什么只需要设...
[ValueDropdown("TextureSizes")] public int SomeSize1; [ValueDropdown("FriendlyTextureSizes")] public int SomeSize2; [ValueDropdown("FriendlyTextureSizes", AppendNextDrawer = true, DisableGUIInAppendedDrawer = true)] public int SomeSize3; [ValueDropdown("GetListOfMonoBehaviours", AppendNextDrawe...
UnityEditor.EditorWindowwindow=GetWindow(typeof(EditorGUIExample));window.position=newRect(0,0,150,60);window.Show();} voidOnGUI(){ showPosition=EditorGUI.Foldout(newRect(3,3,position.width-6,15),showPosition,status);if(showPosition)if(Selection.activeTransform){ Selection.activeTransform.position...
4.7 Dropdown Dropdown 提供选择的选项列表. 可以为每个选项指定文本字符串和可选的图像,可以在Inspector检查器中设置,也可以从代码中动态设置. 改变时触发OnValueChanged 4.8 Input Field 输入框,有两个unityevent 4.9 Scroll Rect (Scroll View) 当占用大量空间的内容需要在一个小区域中显示时,可以使用它。滚动条提...
下面的示例打开了一个带有按钮的编辑器窗口。单击该按钮可显示上下文菜单,您可以通过该菜单更改应用于窗口中 GUI 的颜色。将示例的内容复制到名为 GenericMenuExample.cs 的脚本中,然后将其置于您项目中的 Editor 文件夹内。.using UnityEngine; using UnityEditor;public class GenericMenuExample : EditorWindow { /...
GUI是Unity 的基础的IMGUI类,用于代码创建UI、位置、大小,提供了各种类型的控件,比如标签、按钮、滑动条等、 使用这个类,需要手动指定控件的位置和大小,也就是Rect,使用字符串和Textrue2D来定义控件的内容。 支持编辑器和运行时。 2-3-2、静态变量 属性 介绍 backgroundColor 用于GUI渲染的所有背景元素的全局着色...
wantsLessLayoutEventsSpecifies whether a layout pass is performed before all user events (for example, EventType.MouseDown or EventType.KeyDown), or is only performed before repaint events. wantsMouseEnterLeaveWindowChecks whether MouseEnterWindow and MouseLeaveWindow events are received in the GUI in...
SourceTree: A user-friendly GUI that works with Git and Bitbucket. These tools are good for SCM beginners because they enable fast setup and easy use. To get started, you’ll need an existing Unity project on your local machine. If you do not have one, complete the following project:Spac...
You can replace yourGenericMenuwith aDropdownMenueverywhere. For example, you can use it withEditorGUI.DropdownButton(). The dropdown window will look like this: More Info DropdownItem Once the number of items pass a certain threshold (10 items by default), a search bar will show up where...
public const string id = "ExampleToolbar/Dropdown"; static string dropChoice = null; public DropdownExample() { text = "Axis"; clicked += ShowDropdown; } void ShowDropdown() { var menu = new GenericMenu(); menu.AddItem(new GUIContent("X"), dropChoice == "X", () => { text =...