Unity "xxx Class" is missing the class attribute 'ExtensionOfNativeClass' 解决方案

Unity "xxx Class" is missing the class attribute 'ExtensionOfNativeClass'
翻译:‘xxx Class’缺少类属性 `ExtensionOfNativeClass`

这个就是当脚本继承了MonoBehaiour, 才会有这个属性;然而没有继承自MonoBehaviour, 却被挂到了场景中(这样的神操作不知道是怎么发生的)。

解决办法:
1) 让该类继承自`MonoBehaviour`即可,但要注意Unity对采用直接调用构造函数,如 new ClassA() 形式创建MonoBehaviour脚本对象的方式会报Warnning的;
2) 把脚本在场景中挂载中移除即可,就像删除MonoBehaviour对象一样

 

参考以及感谢网友们的无私贡献:
https://blog.csdn.net/Tang_AHMET/article/details/108163565

posted @   opencoder  阅读(1293)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示