当前位置:网站首页>Unity关于编辑器扩展自定义标签,方便扩展Inspector
Unity关于编辑器扩展自定义标签,方便扩展Inspector
2022-08-03 08:08:00 【charlsdm】
Unity关于编辑器扩展自定义标签,方便扩展Inspector,下边附上我写的代码的案例,方便大家学习,或者观看
public enum IngredientUnit {
Spoon, Cup, Bowl, Piece }
// Custom serializable class
[Serializable]
public class Ingredient
{
public string name;
public int amount = 1;
public IngredientUnit unit;
}
public class Recipe : MonoBehaviour
{
public Ingredient potionResult;
public Ingredient[] potionIngredients;
[Range(0f, 10f)]
public float myfloat = 0f;
[MyRangeAttribute(10.0f,100.0f)]
public float Otherfloat;
}
public class MyRangeAttribute : PropertyAttribute
{
public readonly float min;
public readonly float max;
public MyRangeAttribute(float min,float max)
{
this.min = min;
this.max = max;
}
}
边栏推荐
猜你喜欢
随机推荐
2022下半年软考「高项&集成」复习计划ta来喽~
mysqlbinlog: unknown variable 'default-character-set=utf8'
mysql备份时的快照原理
Logic Pro X自带音色库列表
前缀和(区间和,子矩阵的和)
Evaluate: A detailed introduction to the introduction of huggingface evaluation indicator module
服务器资源监控工具-nmon、nmon_analyser
数仓4.0(二)------ 业务数据采集平台
BOM系列之localStorage
ArcEngine (3) zoom in and zoom out through the MapControl control to achieve full-image roaming
HCIP练习02(OSPF)
RViz报错: Error subscribing: Unable to load plugin for transport ‘compressed‘解决方法
Poke the myth of Web3?Poke the iron plate.
mysql存生僻字奇怪问题,mysql为什么不能辨别mb4字符?
Logic Pro X built-in sound library list
timestamp
[ 漏洞复现篇 ] yapi 代码执行 getshell 漏洞复现详解
vs 2022无法安装 vc_runtimeMinmum_x86错误
ArcEngine(一)加载矢量数据
ArcEngine (4) Use of MapControl_OnMouseDown