- Home /
Prevent long scene loading times due to prefabs in Android?
I am trying to solve an issue with a small game when it comes to scene loading times. In the Editor, things happen nearly instantly. However, in the full build on Android, the scene load can take 30 seconds or so.
At first I thought it might be the music and sound effects causing this, but after optimizing everything there as far as they could be, and testing line by line in the game controller this appears to be directly due to the prefabs.
They are all random objects, in the sense of Little Inferno, but can spawn multiple times. My latest attempt at solving this was to delay the prefab load until the scene load was confirmed, which appeared to work in the editor but still produced this delay on Android.
The array of objects is only thirteen long, but this seems enough - when referenced through the editor and a GameObject[] array - to slow the loading down, even though no object is bigger then 50kb. After loading, the game runs fine, even when the scene is reloaded.
What could I do to handle this kind of issue?
Answer by DevMerlin · Dec 02, 2018 at 06:27 PM
Figured out the issue. Unity's Android player does NOT like MeshColliders, even on relatively light objects.
Going through each prefab one by one I finally found that a simple tire object with a mesh collider was causing a 30-40 second load time. Replaced it with a cube collider, and the load time vanished.
Your answer