unity 脚本中的一些attribute

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是能进一步展开的,这个很有用

 

posted on 2014-01-15 13:26  leonwei  阅读(141)  评论(0编辑  收藏  举报