[Unity]The same field name is serialized multiple times in the class or its parent class.

mac2022-06-30  25

 

 

The same field name is serialized multiple times in the class or its parent class. This is not supported: Base(Test) value

报错,子脚本和 父脚本 具有 相同 名字 和类型 的变量。

 

public father:MonoBehaviour

{

public int test_;

}

 

public son:father

{

public int test_;

}

 

把子脚本 或者 父脚本 的int 类型 的同名变量test_更改其中的一个 名字,使其 都不重名。

 

 

参考资料:

1.unity3d:子类父类共用同个public变量,多次序列化报错

2.

 

 

最新回复(0)