I am having some trouble figuring out the proper use of libGDX's AssetManager class. From what I understand, you are never supposed to create a static instance of an AssetManager. The alternative that people suggested was to pass around the AssetManager reference to every single class that uses it. I'm wondering if what I have proposed below is another safe alternative.
public class GdxGame extends Game {
private AssetManager assets;
....dispose, create AssetManager etc
public static AssetManager getAssets() {
return ((GdxGame) Gdx.app.getApplicationListener()).assets;
}
}
I really don't want to have to pass an AssetManager or an Assets class around to every single class in the game, so I'm trying to figure out a solution that allows some kind of static referencing. Is this safe?