Jump to content
  • Advertisement
Sign in to follow this  

Unity Resource Management implementation details

This topic is 3799 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am not sure why, but I enjoy writing asset/resource management/cache/pooling code (henceforth ‘resource managers’ despite my apprehension towards this naming) ... whatever you want to call those high level constructs that facilitate the creation and sharing of objects that are difficult or costly to create (or both). As my coding friends will tell you, over the years I have gone through many iterations of code to handle these operations and many more experiments. What I want to ask the community is, what features do you look for (or create) when designing a system like this? More specifically: What sort of features or operations do you like to be able to perform on managers for specific resources? Reference Counting? O(1) access time? What sort of features or operations do you like to be able to perform across all managers in your application? How do you handle the creation of objects within a manager? Are they created internally by the manager? If so, have you run into the forwarding problem (WTB: variadic template args!) when trying to design generic resource creation functions (Yes I know the cut-and-paste “hack” to implement this) or do you fall back on a single creation structure argument? Do you supply the manager with a pointer to a functor/function that knows how to create the object? How do you handle accessing that data? Does your Manager::create(…) function return a shared_ptr? a handle? An integer? A pointer? Something else? Nothing? Who owns each created manager? Are they broken up by application subsystem (Render system owns Texture manager for example), or held centrally? How do you allow for creation of resources across application subsystem? For example (well, a contrived example), your ‘Scene’ needs to have a texture loaded for some entity, but the texture needs to be loaded by your API specific rendering implementation. Do you create video resources through the renderer’s interface? Pass manager pointers around? Use singletons (icky ;))? Do you prefer to have a Resource Manager interface, a template or something else? I guess my motivation for this post is, I know how I would answer these questions, but in an attempt to further refine my code there are definitely be things I haven’t thought about. I’m fairly certain that some sort of resource management system finds its way into even beginner level code, so almost everyone here should have some feelings on the subject and I’d love to pick your brains. I am sure there is something about resource management that I left off, feel free to add!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!