Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Libgdx reload scene2d skin after application hidden

Tags:

java

libgdx

I'm having an issue with libgdx skin.

When the app is paused or goes into the background and then reopens all my scene2d textures are just showing up black. I assume that the underlying textures need to be reloaded.

I'm creating my skin using the following code

FileHandle jsonFile = Gdx.files.internal( "ui/uiskin.json" );
FileHandle atlasFile = Gdx.files.internal( "ui/uiskin.atlas" );
TextureAtlas atlas = new TextureAtlas(atlasFile);
skin = new Skin(jsonFile, atlas);

My question is if there any way that I can detect when the texture needs to be reloaded and how to best do this?

like image 477
user2358285 Avatar asked Nov 02 '22 22:11

user2358285


1 Answers

I have found that it is best to rebuild the skin when you reopen your app.

like image 65
joey.enfield Avatar answered Nov 15 '22 07:11

joey.enfield