Search Unity

Loading Prefabs Asynchronously

Discussion in 'Scripting' started by lupidan, Apr 9, 2014.

  1. lupidan

    lupidan

    Joined:
    Jan 14, 2014
    Posts:
    47
    Hello,

    I am developing a videogame where the levels are generated using external files. I was trying to develop a Resources manager, to load the prefabs I specified in a list.
    I am looking for a way to load the prefab resources without blocking the User Interface. Resources.Load seems to block the interface for a bit while loading the prefabs and its dependencies (scripts, textures... ).

    ¿Is there any way to load the prefabs in the Resources folder WITHOUT having to use AssetBundles for each prefab?

    Thanks in advance
     
  2. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Do them in chunks in a coroutine in order to not load the entire level in a single frame.
     
  3. lupidan

    lupidan

    Joined:
    Jan 14, 2014
    Posts:
    47
    Did it in chunks using a coroutine and yielding for 0.1 seconds when needed. Looks natural and nice.
    Thanks for the tip :)