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是能进一步展开的,这个很有用
时间: 2024-09-12 23:56:08