UnityError The same field name is serialized multiple times in the class or its parent class. This

Posted peng18233754457

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UnityError The same field name is serialized multiple times in the class or its parent class. This 相关的知识,希望对你有一定的参考价值。

相同的字段名在类或其父类中被多次序列化。这是不支持的,

这里指的是 变量i .

写如下两个脚本挂到新项目的相机上运行就会出现这个问题:

public class Father : MonoBehaviour
{
    public int e;

    private void Start()
    {
        e = 1;
    }
}
public class Son : Father
{
    public int e;

    private void Start()
    {
        e = 2;
    }
}

 

以上是关于UnityError The same field name is serialized multiple times in the class or its parent class. This 的主要内容,如果未能解决你的问题,请参考以下文章