使用动态网格物体时,Unity Full build崩溃 [英] Unity full build crashes when using dynamic meshes

查看:281
本文介绍了使用动态网格物体时,Unity Full build崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个Unity项目,该项目在编辑器中运行没有问题.但是,今天我去测试了完整的Windows桌面版本(可悲的是,有一段时间没有做过一次),但是桌面崩溃了.

I'm working on a Unity project which runs without issue from within the Editor. However I've gone to test a full Windows desktop build today (having not done one in a while, sadly) and I get a crash to desktop.

菜单"和加载"场景可以正常工作.崩溃发生在我开始玩新游戏后-显示了游戏场景的初始帧,崩溃随后发生了.

The Menu and Loading scenes work without issue. The crash happens after I start a new game - the initial frame of the game scene is shown, and the crash happens immediately after.

我现在正在寻找问题的根源.我正在作为开发版本运行,正在检查每次生成的故障转储日志.

I'm trying to find the source of the problem now. I'm running as a development build, and I'm checking through the crash dump logs it generates each time.

错误日志显示:

Read from location 00000175 caused an access violation.

output_log.txt包含很多看起来都不错的东西,然后突然:

And the output_log.txt contains a load of stuff that all looks ok, and then suddenly:

Crash!!!
SymInit: Symbol-SearchPath: '.;F:\Projects\Code\Unity\Pub Demo;F:\Projects\Code\Unity\Pub Demo\Build;C:\WINDOWS;C:\WINDOWS\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 530, UserName: 'Octopoid'
OS-Version: 10.0.10586 () 0x100-0x1
F:\Projects\Code\Unity\Pub Demo\Build\Pub Demo.exe:Pub Demo.exe (00007FF7AAE80000), size: 25665536 (result: 0), SymType: 'PDB', PDB: 'F:\Projects\Code\Unity\Pub Demo\Build\player_win_development_x64.pdb', fileVersion: 5.3.3.3441

( N.B.崩溃日志相当大,所以我避免将它们全部发布-请让我知道它们中的任何其他部分是否有帮助.)

我尝试在几个地方添加一个Debug.Log,似乎一切都在唤醒并开始,而没有问题,并且在此之前更新循环进行了两次.

I've tried added a Debug.Log into a couple of places and it would appear that everything is awaking and starting without issue, and the update loop is going around twice before this happens.

但是,该项目相当大,我不知道从哪里开始寻找问题-我真的希望有比添加Debug更好的方法.登录到每个Awake/Start/Update/etc.

However, the project is fairly sizable and I have no idea where to start looking for the issue - I really hope there's a better way than adding a Debug.Log into EVERY Awake/Start/Update/etc.

  • Unity 5.3.3 f1个人版
  • Windows 10专业版(1511)

如何找到崩溃的原因?

推荐答案

经过痛苦的测试和困惑,最终解决方案非常简单.我的脚本之一是生成程序网格. 根据文档,我在网格物体上调用了MarkDynamic():

After much painful testing and confusion, the solution was in the end extremely simple. One of my scripts is generating a procedural mesh. As per the documentation I was calling MarkDynamic() on the mesh:

this.mesh.MarkDynamic();

完成此操作后,设置mesh.vertices属性将导致构建立即崩溃,而没有任何特定的错误消息或日志.

Having done this, setting the mesh.vertices property causes the build to crash immediately without any specific error messages or logs.

无论此功能在后台执行什么操作,问题似乎只会影响构建,而不会影响编辑器.

Whatever this function does under the hood, the problem only seems to affect the build, not the editor.

无论是否使用Clear(),我都尝试在实例化之后,设置顶点之前进行调用-无论我如何尝试,MarkDynamic()似乎对我来说都会使构建崩溃.

I've tried making the call just after instancing, just before setting the vertices, when using Clear() or not - whatever I tried, MarkDynamic() just seems to make the build crash for me.

我已应用的修复程序只是删除了此调用-性能似乎与编辑器中的功能完全相同.

The fix I've applied is simply to remove this call - performance seems to be exactly the same as in the editor.

非常感谢@Programmer,为您发现此问题提供了所有帮助!

Many thanks to @Programmer for all your help finding this issue!

这篇关于使用动态网格物体时,Unity Full build崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆