1

我正在使用 Unity 2019.3.15f1 构建投币游戏,主要特点是使用物理引擎模拟投币游戏桌。

游戏启动后,运行30秒到2分钟前会崩溃。

我有一个这样的崩溃日志:

1 libc.tgkill(tgkill:8)
2 libc.pthread_kill(pthread_kill:68)
3 libc.raise(raise:28)
4 libc.abort(abort:60)
5 libc.__fortify_chk_fail(__fortify_chk_fail:0)
6 libc.___clock_nanosleep(___clock_nanosleep:0)
7 libunity.0xb21bd8(Native Method)
8 libunity.0xb21c48(Native Method)
9 libunity.0xb0af74(Native Method)
10 libunity.0xb005c8(Native Method)
11 libunity.0x9f09b8(Native Method)
12 libunity.0xa064cc(Native Method)
13 libunity.0xa06370(Native Method)
14 libunity.0x2d871c(Native Method)
15 libunity.0x244e44(Native Method)
16 libunity.0x245170(Native Method)
17 libunity.0x244f58(Native Method)
18 libunity.0x2e9388(Native Method)
19 libunity.0x2d6720(Native Method)
20 libunity.0x26b1f8(Native Method)
21 libunity.0x26b22c(Native Method)
22 libunity.0x26b464(Native Method)
23 libunity.0x36cdd0(Native Method)
24 libunity.0x37f344(Native Method)
25 base.0x314050c(Native Method)

在为 libunity 相关消息运行 addr2line 后,我得到了这个:

physx::Gu::PersistentContactManifold::reduceBatchContacts(physx::Gu::PersistentContact const*, unsigned int, float)
??:?
physx::Gu::PersistentContactManifold::addBatchManifoldContacts(physx::Gu::PersistentContact const*, unsigned int, float)
??:?
$x.56
??:?
physx::Gu::pcmContactConvexConvex(physx::Gu::GeometryUnion const&, physx::Gu::GeometryUnion const&, physx::PxTransform const&, physx::PxTransform const&, physx::Gu::NarrowPhaseParams const&, physx::Gu::Cache&, physx::Gu::ContactBuffer&, physx::Cm::RenderOutput*)
??:?
physx::PxcDiscreteNarrowPhasePCM(physx::PxcNpThreadContext&, physx::PxcNpWorkUnit const&, physx::Gu::Cache&, physx::PxsContactManagerOutput&)
??:?
void PxsCMDiscreteUpdateTask::processCms<&physx::PxcDiscreteNarrowPhasePCM>(physx::PxcNpThreadContext*)
??:?
PxsCMDiscreteUpdateTask::runInternal()
??:?
$x.235
??:?
JobQueue::Exec(JobInfo*, long long, int)
??:?
JobQueue::ExecuteJobFromHighPriorityStack()
??:?
JobQueue::ProcessJobs(JobQueue::ThreadInfo*, void*)
??:?
JobQueue::WorkLoop(void*)
??:?
Thread::RunThreadWrapper(void*)
??:?

似乎告诉我问题出在 PhysX 引擎中。然后我找到了一个相关的帖子: https ://forum.unity.com/threads/debugging-unhandled-null-exception-in-editor-game-view.503475/

但是在物理设置中禁用 PCM(Persistant Contact Manifold)后,崩溃仍然存在。

有人对这个问题有任何线索吗?任何想法或猜测将不胜感激。

提前致谢。

我已经尝试过的:

  1. 减少刚体。
  2. 在时间设置中增加固定时间步长。
  3. 用盒子碰撞器替换网格碰撞器。
  4. 关闭/打开持久接触歧管。(通过选择旧版联系人生成)
  5. 升级到 Unity 2019.4.4f1
4

1 回答 1

1

升级到 2019.4.4f1 后,在构建设置中关闭 x86 架构,崩溃日志从fortify_chk_fail变为stack_chk_fail+6

通过从谷歌搜索stack_chk_fail+6,有一个帖子有同样的问题。

关联

原因是我使用了 MeshCollider 和超过 255 个三角形的网格,很多。我创建了缓存太多对象的对象池,即使它们被禁用。

将Mesh Collider改为box collider,并减少对象池的缓存量后,crash就消失了。

由于没有人访问此帖子,因此我想我应该感谢自己。

做得好!!!

于 2020-07-25T07:39:31.583 回答