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

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 由我们自己创建,放在任意资源目下即可,为了防止Burst被剔除,我们加入下面这句:

<linker>
    <assembly fullname="Unity.Burst" preserve="all"/>
</linker>

然后,问题就解决了,其它类似问题,都可以通过定制link.xml来解决,具体参看:官方文档中

猜你喜欢

转载自blog.csdn.net/tom_221x/article/details/118787240