How smooth load a lot of gameobjects?

Hi~

My game is a open world. So here a lot of gameObjects and models will load at runtime.

I load them use coroutine. But still laggy(low FPS).

Is here any method could improve ths load processing?

Are you sure the lag is because of the loading? Usually the bottleneck is more because there are too many objects on screen.
Did you check the profiler?

Is it laggy after the objects have initially loaded in or is it just during the initial load? If it’s just during the initial load you could implement a loading screen to wait on things to load.

Here are some options that can help cut down load time and processing:

  • GPU Instancing
  • Static Batching
  • Occlusion Culling
  • Fewer lights, as each light causes each material it’s illuminating to have an additional shader pass.
  • Fewer colliders, as each collider causes more physics checks.
  • Using layers, CompareTag, and Physics.IgnoreCollision in combination to cut down on collision checks.
  • Fewer materials.
  • More simple shaders. Eliminate parts of shaders that aren’t being utilized.
  • Fewer objects.
  • Fewer meshes.
  • More simplified meshes. Utilize tools such as the Mesh Optimizer asset or Blender’s Decimate modifier.
  • Fewer uses of GetComponent. Pre-cache components when possible.
  • Pre-caching of transforms and gameobjects if they’re used in scripts. Each call to .transform or .gameObject is more processing time.
2 Likes

other alternatives:

  • asset store has some world streaming plugins
  • can use DOTS subscenes (unity megacity demo is in github and uses it)
  • can load regular scenes with additive async *but certainly still noticeable lag when object gets created(?) especially with large meshes with colliders…
2 Likes

Thank you!