Could not produce class with ID
遇到的问题
TrailRenderer 拖尾特效在mono下正常,在IL2CPP下消失,对应报错:Could not produce Class With ID xxx
原因:IL2CPP会默认勾选PlayerSetting中Strip Engine Code。TrailRenderer被错误的剔除了
解决方案:
- 打开链接: 在Unity官方手册中ClassIDReference. 首先找到对应的类ID。
- 在Asset目录下创建 link.xml
<linker>
<assembly fullname="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<type fullname="UnityEngine.TrailRenderer" preserve="all"/>
</assembly>
</linker>