In the Managing your assets is said that the following coded will cause issues
public static AssetManager assets = new AssetManager();
But i do not understand the difference between above code and the next code:
public class AssetSingleton {
private static final AssetSingleton instance = new AssetSingleton();
private final AssetManager assets = new Assets();
public AssetManager getAssets(){
return assets;
}
}
...........................................
AssetManager manager = AssetSingleton.instance.getAssets();
So why the first code is unsafe when pausing/resuming the android app? Where and in what way i have to store the AssetManager instance? There is no example in the LibGDX docs. In book "Learning LibGDX Game Development 2nd Edition" there is used singleton with the instance of assetmanager and on resume/pause this singleton loads/unloads resources.
Also is said in Managing your assets:
If you don't set the AssetManager as shown in the last snippet, the usual managed texture mechanism will kick in, so you don't have to worry about anything.
Do i understand correctly: if ihave no singleton and i do not use the static instance of AssetManager - the assets will be loaded and unloaded by LibGDX automatically. If so - how? Whats the difference?