编写脚本
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里看到相应设置