Unity ECS game crashes on android build right after the unity splash screen

Hello! Since ECS is officially released to be used in production, I decided to make my first DOTS based game, and I made an apk to see how it looks on a phone, but then the game crashed right after the boot scene. I cannot tell what exactly caused the crash.
And I cannot find similar issues anywhere. Can anyone help? Is there something I need to change on my player settings? I’m using Unity 2022.3.12f1 with Entities package 1.0.16



I attached my player settings and here is the crash log I got using Android Logcat:

I figured it out by disabling everything and enabling them one by one to see what component/system caused the crash.
In my game, I have a CameraTracker MonoBehaviour class that tracks the position of an entity.
This code caused the crash:

EntityQuery entityQuery = entityManager.CreateEntityQuery(typeof(PlayerTagData));
NativeArray<Entity> allPlayerTagEntities = entityQuery.ToEntityArray(Allocator.Temp);

I figured that Temp allocator might not store the data long enough for my phone’s CPU to pick it up, so I simply used the TempJob allocator since it is said to last up to 4 frames instead of 1.

Then I got this logcat error. On phone, I wasn’t seeing the subscene entities:

Cannot find TypeIndex for type hash 7456786032761509678. Ensure your runtime depends on all assemblies defining the Component types your data uses.

I fixed that too by removing #if UNITY_EDITOR #endif lines I had an IComponentData component and on a SystemBase system. It is probably an ECS bug. But this fixed it.

2 Likes