当前位置:网站首页>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;
}
}
边栏推荐
猜你喜欢
随机推荐
基于SSM开发的的小区物业管理系统小程序源码
timestamp
Using pipreqs export requirements needed for the project. TXT (rather than the whole environment)
Logic Pro X built-in sound library list
LAN技术-2免费ARP
DeFi明斯基时刻:压力测试与启示
volta管理node版本
Karatsuba大数乘法的Verilog实现
实时目标检测新高地之#YOLOv7#更快更强的目标检测器
并发之ReentrantLock
[Hello World] 二分查找笔记
“==”和equals的区别
熊市中预言机,牛市中的战斗机,藏宝计划起飞,坐稳扶好!
BOM系列之localStorage
热部署系统实现
ArcEngine (4) Use of MapControl_OnMouseDown
ArcEngine (six) use the tool tool to realize the zoom in, zoom out and translation of the pull box
WordPress主题-B2美化通用子主题商业运营版
ArcEngine(二)加载地图文档
前缀和(区间和,子矩阵的和)