odin入门和进阶_第三章.md 5.2 KB

DictionaryDrawerSettings,绘制字典的标签,其中KeyLabel可以自定义,标签名称,ValueLabel可以自定义value名称,DisplayMode是折叠样式

![[Pasted image 20240313145507.png]]

对应结构体和枚举

![[Pasted image 20240313145628.png]]

![[Pasted image 20240313145610.png]]

ListDrawerSettings,列表绘制,其中NumberOfItemsPerPage标签,是可以设定分页,也还有很多其他标签功能,按需使用即可

![[Pasted image 20240313145901.png]]

![[Pasted image 20240313150055.png]]

TableList是把列表,以表的形式,展示出来

![[Pasted image 20240313154837.png]]

其中表的类元素,如下所示

![[Pasted image 20240313154846.png]]

![[Pasted image 20240313154915.png]]

TableColumnWidth是自定义表的显示宽度; Resizable是自适应窗体的标签

![[Pasted image 20240313155015.png]]

![[Pasted image 20240313155028.png]]

EnableIf,使能,条件判断

![[Pasted image 20240313160827.png]]

![[Pasted image 20240313160851.png]]

DisableIf标签,和EnableIf相反

![[Pasted image 20240313160955.png]]

![[Pasted image 20240313161006.png]]

ShowIf,显示,条件判断

![[Pasted image 20240313161047.png]]

![[Pasted image 20240313161102.png]]

HideIf,隐藏,条件判断

![[Pasted image 20240313161143.png]]

![[Pasted image 20240313161154.png]]

InlineEditor,直接在属性窗体,看到对应的属性

![[Pasted image 20240313161257.png]]

要显示的结构标签

![[Pasted image 20240313161314.png]]

双击配置文件,当然也是可以点开,看它结构

![[Pasted image 20240313161337.png]]

HideInEditorMode,编辑器模式下,隐藏

![[Pasted image 20240313161458.png]]

运行,才会显示

![[Pasted image 20240313161514.png]]

HideInPlayMode,运行模式下,隐藏,和上者,逻辑相反

![[Pasted image 20240313161541.png]]

![[Pasted image 20240313161605.png]]

DisableInPlayMode,运行模式下,禁用

![[Pasted image 20240313161658.png]]

![[Pasted image 20240313161717.png]]

DisableInEditorMode,编辑模式下,禁用,和上者逻辑相反

![[Pasted image 20240313161755.png]]

![[Pasted image 20240313161806.png]]

DisableInNonPrefabs,只有不是预制体的时候,才会生效

![[Pasted image 20240313162112.png]]

这时候,是生效的

![[Pasted image 20240313162133.png]]

双击点进去,失效

![[Pasted image 20240313162149.png]]

在面板上,失效

![[Pasted image 20240313162208.png]]

DisableInPrefabAssets,预制体的时候,是失效的

![[Pasted image 20240313175426.png]]

![[Pasted image 20240313175443.png]]

点进去,生效

![[Pasted image 20240313175456.png]]

DisableInPrefabInstances,是预制体的时候,生效,在Hierarchy面板,无效

![[Pasted image 20240313175629.png]]

![[Pasted image 20240313175640.png]]

![[Pasted image 20240313175658.png]]

HideInNonPrefabs,如果不是预制体,属性就会隐藏

![[Pasted image 20240313175852.png]]

![[Pasted image 20240313175859.png]]

HideInPrefabAssets,如果是预制体,属性就会隐藏

![[Pasted image 20240313175938.png]]

![[Pasted image 20240313175955.png]]

HideInPrefabInstances,实体是预制体的同时,又在Hierarchy面板,就会隐藏

![[Pasted image 20240313180055.png]]

预制体显示

![[Pasted image 20240313180123.png]]

面板隐藏

![[Pasted image 20240313180134.png]]

MaxValue,设定最大值

![[Pasted image 20240313180227.png]]

![[Pasted image 20240313180234.png]]

MinValue,设定最小值

![[Pasted image 20240313180308.png]]

![[Pasted image 20240313180319.png]]

MinMaxSlider,设定一个最大值和最小值,区间

![[Pasted image 20240313180417.png]]

![[Pasted image 20240313180430.png]]

ProgressBar,自定义进度条样式

![[Pasted image 20240313180508.png]]

![[Pasted image 20240313180538.png]]

PropertyRange,属性滑块控件

![[Pasted image 20240313180637.png]]

![[Pasted image 20240313180645.png]]

Wrap,区间修正,例如超过这个区间,就会自动修正

![[Pasted image 20240313180710.png]]

![[Pasted image 20240313180731.png]]

最基础的Odin窗体,一个字符串字段

![[Pasted image 20240314140104.png]]

入口

![[Pasted image 20240314140123.png]]

![[Pasted image 20240314140146.png]]

这个是多组件整合的,Odin窗体

![[Pasted image 20240314140555.png]]

![[Pasted image 20240314140622.png]]

按钮组,样式会更加规范

![[Pasted image 20240314210627.png]]

![[Pasted image 20240314211016.png]]

OdinMenuEditorWindow 和 OdinMenuTree 相关,通过Add 和 AddAllAssetsAtPath,添加页签

![[Pasted image 20240314211231.png]]

![[Pasted image 20240314211332.png]]

GetTarget方法的重写,可以呈现任意选中类

![[Pasted image 20240314211521.png]]

![[Pasted image 20240314211556.png]]

![[Pasted image 20240314211626.png]]

选中任意一个脚本

![[Pasted image 20240314211646.png]]

使用odin,配合Unity自带组件,可以搭建,控制游戏运行时,对应的逻辑处理,例如控制,按钮动画的点击频率等

![[Pasted image 20240315105828.png]]

其中RequireComponent指的是,需要对应的组件,这里需要的,就是Image和Animator

![[Pasted image 20240315105947.png]]

回到编辑器,例如,如果要移除组件

![[Pasted image 20240315110042.png]]

就会出现对应提示

![[Pasted image 20240315110057.png]]