I'd like to suggest that the entt::loader class support not only a load function but also an unload function for custom teardown logic for resources.
The cache isn't interested in an unload function but nothing prevents you from adding this member to the loader. Why should we force it exactly?
Consider that the resource could be shared, so you shouldn't call unload explicitly on a cache. Instead, it should be invoked when the last instance of a resource goes out of scope. This is already possible though and ofc the destructor can invoke an unload function on the original loader.
This makes sense to me, thanks for the thought. I believe a destructor on the structure that wraps the asset (an external type) should suit my needs.
Yup. This is more or less what I do all the times, according with the requirements of the library in use. :+1:
I'm closing this issue since I think it received an answer. Feel free to reopen it if this isn't the case. Thanks.
Most helpful comment
Yup. This is more or less what I do all the times, according with the requirements of the library in use. :+1:
I'm closing this issue since I think it received an answer. Feel free to reopen it if this isn't the case. Thanks.