Intermingled Read and Render?

Here, we're reading a text file for coordinate data. We'll want to generate meshes and render them. (or use prefabs)

Is there a way to instantiate and render as we read along? Rather than read everything and then render everything? So, we get a sort of "popping" effect.

Although I haven't used them, I'm guessing this is a coroutine deal where the reading is held up while the render is done?

thanks

  • You could make use of threads for the file access if you need this to be done runtime.
  • You could amortize the construction of meshes early and create a list of Meshes.

A coroutine might work if you use the WWW class. Otherwise a coroutine won't be of much use unless you load a few bytes each time.

If you need to continuously stream data, I think a thread could be proper. That way the rest of the game continues even if the load takes some time.

Unless you have a massive amount of data or your code is bad, it would only take a fraction of a second anyway, so it's unlikely you need to worry about it.