Hey community!
We experience crashes on Android when we spawn particle systems and call the Simulate(5); method.
The particle systems has specific settings. You can download attached project zip and try to reproduce it yourself “ParticlesAndroidCrash.zip”.
It happens for us in Unity 2021.1.2f1 and 2021.2.0f1 versions. It should be reproducible on other Unity versions.
This crash is not reproducible on iOS.
This crash is not reproducible on Android in following cases:
- Don’t call the Simulate() method
- Change the Particle System setting in prefab “Ring Buffer Mode” to disabled
- Don’t use Particle System “Trails” component
- Make a debug build (it crashes only in release builds)
You can use one of it as a workaround.
It is difficult to catch the callstack. Sometimes when the app crashes, there is no CrashLog in Unity LogCat. The Android Studio LogCat also does not show the crash logs. One of 10-20 crashes of our app (not the test project) there was a crash log.
If you are lucky enough to catch the crash log, after symbolizing it with Unity Log Cat Symbolizing tool (amazing tool!) you’ll see something like this:
backtrace:
#00 pc 00000000007a5fc0 (tlsf_remove_pool at ??:?)
#01 pc 00000000007a6460 (tlsf_free at ??:?)
#02 pc 00000000007a6418 (tlsf_free at ??:?)
#03 pc 000000000021d718 (DynamicHeapAllocator::smile:eallocate(void*) at ??:?)
#04 pc 000000000021c4ac (DualThreadAllocator<DynamicHeapAllocator>::TryDeallocate(void*) at ??:?)
#05 pc 000000000021db98 (MemoryManager::smile:eallocate(void*, MemLabelId, char const*, int) at ??:?)
#06 pc 0000000000633164 (ParticleTrails::Reallocate(unsigned long, unsigned long) at ??:?)
#07 pc 00000000006208e8 (ParticleSystemParticles::array_reserve(unsigned long) at ??:?)
#08 pc 00000000006264ec (ParticleSystem::StartParticles(ParticleSystemUpdateData&, ParticleSystemParticles&, float, float, unsigned long, unsigned long, float, float) at ??:?)
#09 pc 000000000062d2e0 (ParticleSystem::Update1Incremental(ParticleSystemUpdateData&, ParticleSystemParticles&, float) at ??:?)
#10 pc 0000000000620058 (ParticleSystem::Update1b(ParticleSystemUpdateData&, int) at ??:?)
#11 pc 000000000062024c (ParticleSystem::Update(ParticleSystem&, float, ParticleSystemUpdateFlags, int) at ??:?)
#12 pc 000000000061da44 (ParticleSystem::Simulate(float, ParticleSystem::SimulateFlags) at ??:?)
#13 pc 000000000062e180 (ParticleSystem::SimulateChildrenRecursive(Transform&, float, bool, ParticleSystem::SimulateFlags, dynamic_array<ParticleSystem*, 0ul>&) at ??:?)
#14 pc 00000000001e0dc8 (ParticleSystem_CUSTOM_Simulate(ScriptingBackendNativeObjectPtrOpaque*, float, unsigned char, unsigned char, unsigned char) at ??:?)
We already made two bug reports to Unity:
- Case 1378274 reproduced with Unity 2021.1.2f1 version
- Case 1378282 reproduced with Unity 2021.2.0f1 version
Hey Unity moderators, can you please link the bug reports to this forum thread.
Hopefully the presented workarounds will help somebody.
7629436–949495–ParticlesAndroidCrash.zip (1020 KB)