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 ...
Get Libgdx Cross-platform Game Development Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.