O'Reilly logo

Libgdx Cross-platform Game Development Cookbook by Alberto Cejas Sánchez, David Saltares Márquez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting to know AssetManager

One of the main advantages of using AssetManager is that resources will be reference counted. This means that they will be allocated in memory just once; it doesn't matter how many times you use it in code. This also includes safe dependency disposal; for instance, if an asset X depends directly on another asset Y, the latter will not be deleted until the former has been disposed of.

In terms of organization and clarity, it is a good point to gather all resources in the same place, so it is a recommended practice to always include AssetManager.

Obvious, but not less important, is the fact that AssetManager allows us to load resources whenever we need them, neither before nor after. We have to bear in mind that Libgdx's ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required