「Unity3D」真机Burst闪退崩溃:Unable to find internal function Unity.Burst.LowLevel.BurstCompilerServices

当Unity项目开启BurstCompile并在真机上运行时,可能会遇到因UnityLinker剥离代码导致的崩溃问题。日志提示'Unable to find internal function Unity.Burst.LowLevel.BurstCompilerServices'。为了解决这个问题,需要调整打包选项,选择中等剥离级别或者自定义link.xml文件以保留必要的代码。通过在link.xml中添加Preserve指令,可以避免关键代码被剥离,从而避免闪退。参考官方文档可以了解更多关于代码剥离和定制的细节。
摘要由CSDN通过智能技术生成

Unity,在开启了[BurstCompile]之后,编辑器可以正常运行,但在真机上会闪退,日志显示:

Unable to find internal function Unity.Burst.LowLevel.BurstCompilerServices::GetOrCreateSharedMemory

这是因为开启了打包选项中,剥离代码的高级水平,如下图

在这里插入图片描述
事实上,在官方文档中就指出,High Stripping Level需要使用link.xml来定制,代码具体的剥离规则。

When you select the High Managed Stripping Level, UnityLinker removes
as much unreachable code as possible and produces smaller builds than
Medium stripping level. High stripping level prioritizes size
reduction over usability; you might need add link.xml files, Preserve
attributes, or even rewrite problematic sections of code.

link.xml 由我们自己创建,放在任意资源目下即可&

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值