Download

Switching Levels on Android Causes game to crash?

Every time i call open level, the game freezes up for a few seconds, the screen goes black, and then the game crashes. it doesnt matter what level it is, even if i just try to restart the current level, the game crashes. I can use whatever map i want in the Game Default Map, all three of them work when i test on the device, but if i actually call Open Level in a blueprint, Crash. What can I do to resolve this issue?

I can think of three possible reasons for this.

The first is the levels not being included in packaging. How do you open the level? If you do it by executing a console command node, for example, the packer won’t see the reference, and won’t include the level by default – you will have to add your levels to the “levels to include when packaging” setting in the project settings (I forget the exact name.)

The second is memory exhaustion. Android phones are not PCs. Each program running has a limited amount of RAM, which may be less than the total amount of RAM in the system, and if you try to go over, you won’t get to use the “hard disk” as a buffer, but instead the process is just killed. To reduce the risk of this happening, try to unload the existing level first, before loading the new level.

The third is compatibility. Graphics drivers are notoriously bad on mobile devices (even Apple devices, although there’s less diversity there so specific work-arounds generally solves for more of the devices.) Anything that happens when re-loading a level might conceivably tickle some driver bug. Test on a number of different devices to figure out whether this could be an issue.

Finally, I highly recommend using LogCat or a similar tool to actually see what’s going on in the device as it’s loading your game. If possible, also get the logs for the game itself, and compare/correlate to see where the load fails.