I’m developing a simple tank game for Android and I’m using object pool for better performance. Tanks are created using a object pool, then each tank has a object pool for projectile. The game runs normal in Unity, but on Android it crashes at Unity startup loading screen. I tested the game and it works if I remove the projectile pool.
What error are you receiving? It should display an exception or some error if you use adb logcat.
The first two thing that come to mind: you’re either pooling too many objects and the game crashes because it uses too much memory or you may be calling GetPooledObject before Start is called.
For testing i use only one object for each pool, with the script mentioned above, nothing else, but it keeps crasing on Android.
This are the main errors from logcat:
09-25 23:03:00.968 W/Unity (24755): GpuProgram creation error: empty shader string
F/libc (24755): Fatal signal 11 (SIGSEGV) at 0x00000038 (code=1), thread 24773 (UnityMain)
I/DEBUG (16265): #00 pc 00461440 /data/app-lib/com.artanks-2/libunity.so
W/InputDispatcher(1017): channel ‘42e981a8 com.artanks/com.unity3d.player.UnityPlayerNativeActivity (server)’ ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher(1017): channel ‘42e981a8 com.artanks/com.unity3d.player.UnityPlayerNativeActivity (server)’ ~ Channel is unrecoverably broken and will be disposed!
W/ActivityManager(1017): Force removing ActivityRecord{42d5dc70 u0 com.artanks/com.unity3d.player.UnityPlayerNativeActivity}: app died, no saved state