Archive 17/01/2023.

Are resources loaded by ResourceCache stored in memory?

throwawayerino

I’m passing references to an image and don’t want to have copies around
And if it is stored in memory, how could I release them?

Dave82

Resources in urho are reference counted. This means resources which reference count reaches 0 are automatically deleted. When you load a resource in resourcecache it’s reference counter is increased by 1 when you use this resource somewhere in the scene the ref count increases each time you’re refering to the resource. To remove unused resources call
Cache->removeUnusedResources()

This will remove all resources with ref count of 1 (referenced only in resource cache)

Modanung

You can also use GetTempResource. This will not store the resource in the cache.