unity 脚本中的一些attribute

来源:互联网 发布:c 数组删除指定位置 编辑:程序博客网 时间:2024/05/16 08:21

1.Serializable

The Serializable attribute lets you embed a class with sub properties in the inspector.

让你能够把它嵌入到另外一个class时在属性编辑器里能将其展开

 

[System.Serializable]

class Test{

public int p = 5;

public Color c = Color.white;

}

 

public class Test2:MonoBehaviour{

     public Test[] t;

}

 

这样在编辑器里Test里的t是能进一步展开的,这个很有用

 

0 0
原创粉丝点击