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

2023-08-24 14:24:46 浏览数 (1)

The same field name is serialized multiple times in the class or its parent class. This is not supported: Base(MonoBehaviour) txtTitle UnityEditor.HostView:OnGUI()

工程中搜索txtTitle 可以看到 父类

代码语言:javascript复制
public abstract class UILoading
    {
        public Text txtTitle;
        public Text txtTips;

子类

代码语言:javascript复制
public class UISimpleLoading:UILoading
    {
        public Text txtTitle;
        public Text txtTips;

这样在编辑器中是正常的,但是不能打包,不可多次序列化,要子类或者父类改名

0 人点赞