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

5.2 KiB
Raw Permalink Blame History

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