I have a HexGame class extending Game and various Screens that receive the game object in their constructor. I was thinking of having one AssetManager in the game class and using it to load the necessary assets in each screen's constructor and unload them in the screen's dispose method. The alternative would be to use a new AssetManager in every screen. What would be best practice?


1 Answer 1


I would suggest using a single AssetManager, unless your assets are so large that memory would be a problem.

Again, depending on your size, you may also want to just load all assets up front. You would probably prefer to not load and unload assets during game play if it can be avoided. This will make screen transitions quicker/smoother.

One reason though to use multiple AssetManagers is if you're loading from different locations. As an example, for my last LibGDX project, I was loading a small number of included assets locally, but also loading assets from AWS S3, with some local caching. So I had two AssetManagers to handle those cases.

  • \$\begingroup\$ Assuming I use a single manager and an asset in a screen is never going to be used again in another screen, isn't it wise to unload it upon screen disposal? \$\endgroup\$
    – alfoks
    Commented Jul 31, 2017 at 21:39
  • 1
    \$\begingroup\$ @alfoks possibly if you really need to conserve space. But that sounds like premature optimization. Also is it really only going to be once? I'd be more concerned that the design plans to build something that's only used once. Effort vs. reward seems low. \$\endgroup\$
    – CLo
    Commented Aug 1, 2017 at 2:57
  • \$\begingroup\$ Talking theoritically. I'm still building the skeleton of a game with hex maps. I have 2 - 3 ideas of what game to build from that. But yes it makes sense. Logically a game will have 3 - 4 screens. \$\endgroup\$
    – alfoks
    Commented Aug 1, 2017 at 11:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .