template<typename T>
AssetManager class
Centralized, templated utility for managing the lifecycle of engine resources.
Uses reference counting (std::shared_ptr/std::weak_ptr) to automatically free assets when they are no longer in use.
Public static functions
- static auto Get(const std::string& path) -> std::shared_ptr<T>
- Retrieves a reference-counted asset.
- static void GarbageCollect()
- Clears references to assets that are no longer in use.
Function documentation
template<typename T>
static std::shared_ptr<T> engine:: util:: AssetManager<T>:: Get(const std::string& path)
Retrieves a reference-counted asset.
| Parameters | |
|---|---|
| path | The path to the asset. |
| Returns | A shared pointer to the asset, or nullptr if loading fails. |
If the asset is already in the cache and still alive, it returns it. Otherwise, it calls T::Load(path) to create it.