版权声明:版权声明:本文为博主原创文章,未经博主允许不得转载,博客地址:http://blog.csdn.net/xpala https://blog.csdn.net/xpala/article/details/89368168
编写脚本
public class Serializable : MonoBehaviour
{
public Test test;
// Update is called once per frame
void Update()
{
Debug.Log(test.id +" "+ test.name+" "+ test.vector3);
}
}
[System.Serializable]
public class Test:System.Object
{
public int id = 100;
public string name = "xpw";
public Vector3 vector3;
}
脚本应用于Object上,可以在Inspector里看到相应设置