質問

I am developing a platform game in libgdx. I use The AssetManager class to load all my assets to the game. So, My question is: Do I need to dispose my textures and atlases even when I am unloading them with the assets manager?

This is how I load them:

game.manager.load("img/background2.png",Texture.class);
game.manager.load("img/background2up.png",Texture.class);
game.manager.setLoader(TiledMap.class,new TmxMapLoader(new InternalFileHandleResolver()));
game.manager.load("maps/map15/map15.tmx",TiledMap.class);

This is how I unload them:

  game.manager.unload("maps/map15/map15.tmx");
  game.manager.unload("img/background2.png");
  game.manager.unload("img/background2up.png");

This is how I recieve, for example the backgrounds from the assats manager class:

background = game.manager.get("img/background2.png");
continBackground = game.manager.get("img/background2up.png");

Do I need to attach this to the dispose method?: background.dispose(); continBackground.dispose();

Sorry for my poor english.

役に立ちましたか?

解決

You do not need to call dispose, calling unload is correct.

See here: https://code.google.com/p/libgdx/wiki/AssetManager

It says specificaly "Assets managed via the AssetManager shouldn't be disposed manually, instead call AssetManager#unload()!"

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top