当前位置:网站首页>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;
}
}
边栏推荐
猜你喜欢
随机推荐
ArcEngine(五)用ICommand接口实现放大缩小
tolower函数
面渣逆袭:MySQL六十六问,两万字+五十图详解
“==”和equals的区别
牛客 - 鼠标的天选(字符串哈希)
ArcEngine (3) zoom in and zoom out through the MapControl control to achieve full-image roaming
Logic Pro X自带音色库列表
进程的创建
面试介绍项目经验(转)
DeFi明斯基时刻:压力测试与启示
36氪详情页AES
前缀和(区间和,子矩阵的和)
uniapp swiper 卡片轮播 修改指示点样式效果demo(整理)
mysql 8.0.12 安装配置方法并--设置修改密码
集群
wordpress: 裁剪您的图片时发生错误
二进制日志过期时间设置expire_logs_days
@Async注解的坑,小心
HCIA实验(07)
ArcEngine (5) use the ICommand interface to achieve zoom in and zoom out








