在手機上會遇到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