'Effective way to cache GameObjects including meshes/textures?

Problem:

If possible, I want to cache full GameObjects including meshes that don't exist in the assets, in a way such that I can load them roughly equally quickly as if they were just one of the assets. Even on closing and reopening the app.

Context:

I'm working on an app where I get arbitrary 3D objects from the backend like this:

  1. Download data for 3D meshes from the backend in a byte array
  2. Convert byte[] to GameObjects with Meshes and Texture2D etc. using a plugin (https://github.com/atteneder/glTFast).

Step 2 can take about 2 seconds per asset and uses blocking methods, so the screen freezes.

I could probably pretty easily cache the byte[] to skip the downloading step for repeated assets, but then it still freezes the entire screen, potentially for a pretty long time if there are a lot of assets.

Is there a more effective way to store the entire GameObject that the plugin creates, including meshes and textures etc. that loads (close to) as quickly as a normal asset?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source