在Unity中序列化多个变量的更清洁方法

时间:2016-10-03 19:38:23

标签: c# unity3d

Unity中是否有更简洁的序列化多个私有变量的方法?也许不是

[SerializeField]
private float num1;

[SerializeField]
private float num2;

[SerializeField]
private float num3;

[SerializeField]
private float num4;

它可能是这样的

[SerializeField]
private float num1;
private float num2;
private float num3;
private float num4;
[/SerializeField]

这可能吗?

1 个答案:

答案 0 :(得分:7)

是的,是

[SerializeField]
float num1,num2,num3,num4,num5;
[SerializeField]
string name, lastName, address, school;