Search Unity

Loading A Seamless World Without Freezing

Discussion in 'World Building' started by AkhmedAbasov, Apr 10, 2019.

  1. AkhmedAbasov

    AkhmedAbasov

    Joined:
    Mar 13, 2014
    Posts:
    163
    For a long time I can not find a solution for my task.
    1. I have a city of 1000 buildings
    To keep all these buildings on the same scene uses 500-600 megabytes of memory on mobile devices. Ok, this can be measured.
    2. I want the buildings to have rooms
    If now I keep the rooms on the scene, it will be terrible.

    How can I implement a synchronous load of buildings and rooms?
    Implementing scenes and loading asynchronously - this doesn't work. AsyncLoad is not really async and freezing game.
    Instantiate? No, that freezes the scene too. Instantiate in a separate thread? No, Instantiate cannot be used in a separate thread.

    I wanted to see how the buildings are loaded in the megasity demo, but I could not even open this demo. I think about how to use this near time should not even dream.
    Maybe there is some other solution for dynamic loading?
     
  2. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    90
    It uses a tile based system, where each building is a scene, and gets loaded in and out using async depending on camera distance.
     
  3. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    The core issue is your level/model design. Async is just a bandaid over that problem. You need to redesign your levels and models so you have far fewer meshes. Modularize it in some way. If you look at all of your structures you likely have a lot of duplicate shapes. All of that duplication is memory you have to allocate.

    Reduce the mesh count and then use instanced rendering, or even just DrawMesh. There is just no way that 1000 buildings you don't have tons of duplication of geometry that can be reduced. It might take a bit of thinking to find the patterns but I guarantee they are there somewhere.