Reputation: 321
The problem is when my game is hidden, there is a delay when it's resumed. Each time game is resumed it takes longer. This happens on any screen set including splash screen where assets are being loaded. There is no difference in delay when game is resumed to game screen or splash screen, or menu screen. That means there is no problem with a lot of assets being loaded. I tested other game called "Cut the Rope 2" and there is no such delay, game resumes immediately.
I would like to add, that when I launch application first time, there is no such delay it jumps straight away to splash screen. Also when I press back button, it restarts the whole application and there is no delay also. That means that there is only a delay when application is resumed and there is no delay at all when application is launched first time or restarted.
UPDATE:
My problem is exactly like the one posted in the link below. Problem wasn't solved there. http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=11433&p=51515&hilit=resume+slow#p51515
So the problem is that this is called when my game resumes:
assetManager.finishLoading();
I didn't put that code in resume(). From the link above, I read that it's called automatically. When you press "Back Button" on tablet and then you resume the game, it takes time to launch application. If you press "Lock Button" and then you resume the game it launches game immediately but it freezes. So there are two different behaviors according to the button which was pressed. I would prefer to launch game immediately and not freeze but play my loading screen. Is there any way to do this?
Upvotes: 0
Views: 431
Reputation: 321
The solution to this problem is to call
Texture.setAssetManager(manager);
In this way AssetManager.finishLoading() will not be called automatically when game is resumed. Therefore it will not reload any assets. AssetManager.update has to be called manually.
Upvotes: 0