Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.87k stars 825 forks source link

ConcreteTexture - uploadBitmapData() #859

Closed Jacowaco closed 8 years ago

Jacowaco commented 8 years ago

Hi, in the ConcreteTexture's uploadBitmapData() function, there is this:

if (!Starling.current.isRendering) { trace("[Starling] Warning: uploading bitmap data while Starling is not rendering " + "may cause a crash on some platforms. Ignoring request."); return; }

If my game is opened and get minimized while the AssetManager is loading the textures, the game gets all black and only way you can play it is by closing it and opening it again. When i removed the "return;" the game loads the assets fine, even if minimized. I think this is important.

Jacowaco commented 8 years ago

This is for Starling 1.8.x

PrimaryFeather commented 8 years ago

This warning is actually there to protect you; on some platforms, instead of having a black texture, the game will crash altogether otherwise. Which is normally non-recoverable. ;-)

However, the AssetManager actually attempts to automatically avoid any uploads while the application is in the background. Are you using the default AssetManager, or do you have any extensions / modifications in place? And does this happen for all kinds of textures, or just a specific type?

Jacowaco commented 8 years ago

I'm using the famous "assets.loadQueue(function onProgress(ratio:Number):void" function. The bug happens in Desktop, i haven't tried this bug in mobile devices. It happens to all the textures i have. The only ones i can continue to see are those i had loaded before from embedded assets which my asset manager doesn't control.

PrimaryFeather commented 8 years ago

Okay, I had another look at the code in question, and that's a specific workaround for a problem that was only reported on mobile. Thus, I'm now limiting it to that.

Please let me know if that fixes your problem.

Jacowaco commented 8 years ago

Yes! It fixed the problem! Thanks!

PrimaryFeather commented 8 years ago

Perfect, thanks for trying it out!