在手机上会遇到Could not produce class with ID***的问题,是因为Unity strip掉了用到的脚本
如果是非UnityEngine.dll中的类,会报not found的错,需要new一下改类
参考:
https://blog.csdn.net/huutu/article/details/43986079
如果是UnityEngine.dll中的
需要在link.xml添加该id的类
id:
https://docs.unity3d.com/Manual/ClassIDReference.html
方法:
https://docs.unity3d.com/Manual/IL2CPP-BytecodeStripping.html
还有是在UnityEditor.dll下的
例如
Could not produce class with ID 91(AnimatorController)
不能用link.xml,可以在Resource下建一个空的prefab,在上面挂一个AnimatorController,再打包就可以
但是为什么真机运行时会用UnityEditor.dll的类呢
https://forum.unity.com/threads/webgl-could-not-produce-class-91-engine-stripping.467181/

------by wolf96 2019/2/28

本文详细解析了在使用Unity进行项目打包时遇到的CouldnotproduceclasswithID***问题,主要原因是Unity在字节码剥离过程中移除了未直接引用的类。文章提供了针对不同情况的解决方案,包括如何处理UnityEngine.dll中的类、UnityEditor.dll下的类以及非UnityEngine.dll中的类。通过在link.xml中添加特定ID的类、创建空的prefab并挂载相应组件,以及查阅Unity官方文档,可以有效避免此类错误。
9445

被折叠的 条评论
为什么被折叠?



