用VS2019编译unity代码,写了一个MonoBehaviour的子类来作为角色各个属性的基类。但是在引擎里往角色身上挂载代码的时候提示这个。
public class Attribute : MonoBehaviour
public class MonsterC : Attribute
在external scrip editor里也挂载了VS了,多谢各位。
收起
把Attribute这个类换个名字,或者MonsterC 的继承改成MonsterC : 自定义命名空间.Attribute
Attribute
MonsterC
MonsterC : 自定义命名空间.Attribute
你这个名字和C#的内部System.Attribute冲突,所以你当前继承的应该是System.Attribute,而不是你定义的那个,所以挂载不上
System.Attribute
报告相同问题?