obsidian/笔记文件/2.笔记/odin入门和进阶_第二章.md
2025-03-26 00:02:56 +08:00

262 lines
5.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

在表格中,隐藏标签 HideInTables
![[Pasted image 20240312161207.png]]
只有A和BHidden被隐藏了
![[Pasted image 20240312161233.png]]
脚本相关的显隐
![[Pasted image 20240312161856.png]]
加上标签,默认是没这个标签的
![[Pasted image 20240312161922.png]]
![[Pasted image 20240312162003.png]]
因为加了标签,所以没显示脚本
![[Pasted image 20240312162018.png]]
默认是显示的
![[Pasted image 20240312162039.png]]
自定义类型的隐藏HideReferenceObjectPicker
![[Pasted image 20240312165018.png]]
加了标签的,隐藏对应的类属性
![[Pasted image 20240312165055.png]]
继承自Unity.Object的属性显示InlineEditor
![[Pasted image 20240312165224.png]]
其中的调用
![[Pasted image 20240312165258.png]]
![[Pasted image 20240312165424.png]]
多行文本的输入和显示
![[Pasted image 20240312165513.png]]
![[Pasted image 20240312165521.png]]
方形,选择框,可以选择预览体;
还有调用直接打开odin编辑器的OpenInEditor接口
![[Pasted image 20240312165551.png]]
![[Pasted image 20240312165651.png]]
场景相关的,或者资产相关的选择,筛选
![[Pasted image 20240312165715.png]]
![[Pasted image 20240312165742.png]]
Toggle选择器标签其中Enabled可以在实例化的时候使用也可以在类定义上直接使用
![[Pasted image 20240312165801.png]]
![[Pasted image 20240312165840.png]]
toggle默认是右边的加了ToggleLeft也可以放置在左边
![[Pasted image 20240312165904.png]]
![[Pasted image 20240312165924.png]]
Button按钮相关有各种样式按钮点击触发逻辑
![[Pasted image 20240312170109.png]]
![[Pasted image 20240312170241.png]]
枚举EnumPaging和对应可以触发函数OnValueChanged
![[Pasted image 20240312170554.png]]
![[Pasted image 20240312170619.png]]
根据逻辑这里的枚举会切换unity本身的操作模式
![[Pasted image 20240312170646.png]]
枚举后面可以加按钮EnumToggleButtons
这是定义的枚举结构体
![[Pasted image 20240312170832.png]]
声明调用逻辑
![[Pasted image 20240312170850.png]]
![[Pasted image 20240312170940.png]]
在属性后面添加按钮InlineButton
![[Pasted image 20240312171028.png]]
![[Pasted image 20240312171046.png]]
BoxGroup组centerLabel指的是label文本显示置中也支持$的字符串,赋值语法,包含各种控件内容
![[Pasted image 20240312172536.png]]
组的下级子控件,是用 / 进行划分
![[Pasted image 20240312172707.png]]
![[Pasted image 20240312172756.png]]
标题组TitleGroup
主副标题,相关逻辑
![[Pasted image 20240312172917.png]]
![[Pasted image 20240312172937.png]]
组的属性折叠FoldoutGroup
![[Pasted image 20240312173016.png]]
![[Pasted image 20240312173037.png]]
水平方向 组的创建 HorizontalGroup
![[Pasted image 20240312173132.png]]
![[Pasted image 20240312173144.png]]
相对应的垂直组VerticalGroup
![[Pasted image 20240312173218.png]]
![[Pasted image 20240312173250.png]]
页签组TabGroup用来切换不同的页签组合
![[Pasted image 20240312173350.png]]
![[Pasted image 20240312173423.png]]
Toggle组ToggleGroup相关逻辑当然也是支持List结构
![[Pasted image 20240312173523.png]]
![[Pasted image 20240312173546.png]]
按钮组相关ButtonGroup
![[Pasted image 20240312173812.png]]
![[Pasted image 20240312173837.png]]
窗体位置自适应组ResponsiveButtonGroup
![[Pasted image 20240312173936.png]]
可以用于,比较复杂的组合表现
![[Pasted image 20240312174019.png]]
窗口化的时候,也自适应修改大小了
![[Pasted image 20240312174043.png]]
右键菜单显示对应的自定义函数功能CustomContextMenu
![[Pasted image 20240313140401.png]]
![[Pasted image 20240313140424.png]]
禁用右键菜单相关DisableContextMenu
![[Pasted image 20240313140631.png]]
右键可以点出菜单的,就是没有被完全禁用的
![[Pasted image 20240313140722.png]]
控件的两种绘制形式其中DrawWithUnity标签指的是按照unity的形式绘制
![[Pasted image 20240313140832.png]]
![[Pasted image 20240313140907.png]]
标签Indent可以自定义设置ui缩进
![[Pasted image 20240313141122.png]]
![[Pasted image 20240313141130.png]]
标签InfoBox是可以设置提示信息同时还可以设定布尔传参visibleIfMemberName控制字段是否显示
![[Pasted image 20240313142053.png]]
这个提示,只有在编辑器模式下,才会显示
![[Pasted image 20240313142118.png]]
当然,也可以显示时间相关
![[Pasted image 20240313142151.png]]
![[Pasted image 20240313142133.png]]
运行时InfoBox提示消失
![[Pasted image 20240313142244.png]]
标签InlineProperty控制组件的表现和间距相关
![[Pasted image 20240313142410.png]]
![[Pasted image 20240313142434.png]]
LabelText自定义属性前面的名称
![[Pasted image 20240313142549.png]]
![[Pasted image 20240313142617.png]]
LabelWidth修改属性标签宽度
![[Pasted image 20240313142714.png]]
![[Pasted image 20240313142722.png]]
OnInspectorGUI 调用函数创建自定义检查器GUI
![[Pasted image 20240313142905.png]]
这里的逻辑是监听到变动就调用DrawPreview函数创建一个自定义检查器GUI表现
``` cs
GUILayout.BeginVertical(GUI.skin.box);
GUILayout.Label(this.Texture);
GUILayout.EndVertical();
```
![[Pasted image 20240313142923.png]]
PropertyTooltip标签是鼠标悬停的时候会出现提示文本内容
![[Pasted image 20240313143246.png]]
![[Pasted image 20240313143505.png]]
SuffixLabel标签是可以在组件后面新增自定义提示配合Overlay属性观感上会显示得更加简洁
![[Pasted image 20240313143723.png]]
![[Pasted image 20240313143833.png]]