1.[Header("Health Settings")]//表示在下面字段添加标题
public int health = 0;
2.private int age = 40;//这个私有字段不被序列化
[SerializeField]//强制unity序列化的一个字段,即使是私有的,也会被序列化
private bool hasHealthPotion = true;
3.[RangeAttribute(0, 5)]//在Inspector面板创建名字为下面范围为该属性写的滑动条
public int num;
4.[TooltipAttribute("工具提示")]//该属性为工具提示,在Inspector面板中鼠标放在下面字段将会显示属性内的解释
public int old = 0;
5.[HideInInspector]//使其属性不在Inspector面板中不显示
public int year = 5;
6.[ContextMenuItem("Reset","ResetBiography")]//使其属性可将上下文菜单添加到调用命名方法的字段
public string playerBiography ="";
void ResetBiography()
{
playerBiography = "";
}
7.[DelayedAttribute]
public float delay = 0.5f;//此属性使其用于在脚本中创建浮点,整型或字符串变量的属性被延迟。
Unity部分属性面板解说
猜你喜欢
转载自blog.csdn.net/qq_38456478/article/details/79908778
今日推荐
周排行