Jump to content
  • Advertisement
Sign in to follow this  

Unity Help with theory of loading assets in memory with Unity.

This topic is 1113 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

Hello people i am working on a project that doesnt use standard unity asset pipeline,

im loading meshes not from bundles but from folders, building database of all assets.


Currently i do it like this -

1. load game

2. read through all folders, find definition files

3. if definition uses mesh, i convert .obj to .cache which is bitstream, it loads faster

4. in game on runtime when that particular object is met, i create a GameObject as mesh container,

and then instantiate that mesh and provide it to object that requested it.


Now this causes one problem - load time. Mesh deserialization/build and deployment even for small meshes can take

so significant ms, despite all my optimizations, so right now before i continue doing something stupid, i want someone

who has experience to share some ideas on what would be the best approach.


Additional info:

all objects in game are loaded from directories, this is done because of "open architecture" paradigm we use (mods etc)

the game is massive open world, and done in one scene, so simple "preload per level" will not work.

I will be happy still to hear ideas on preloading into memory and what kind of problems i can run up into.


Thank you!



Share this post

Link to post
Share on other sites



I'm not sure what you mean with point 3, but from the rest some points:


- make sure you use binary .obj or even better some custom format which requires almost no conversion for feeding into Mesh objects 

- pool GameObjects as creating them is expensive

- pool Mesh objects and use MarkDynamic() (never tried this but should save overhead) 

- creating mesh colliders is expensive, unfortunately there is not workaround for this as Unity does not support mesh collider cooking


If you're feeling brave you could move your data loading to native C++ if the loading is the bottleneck.

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!