Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Async Instantiation?

Discussion in 'Prefabs' started by Deeeds, Sep 21, 2018.

  1. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    Hi

    Weird question approaching.

    In the first series of videos about Improved Prefabs, it's suggested they be used somewhat akin to how one might think of scenes for levels.



    This is a great idea, and permits levels to have their own transform, courtesy of the parent Prefab.

    However... it also means a Prefab could have a LOT of stuff in it.

    Is there any way to async the instantiation of a prefab, on a background thread, so it's not going to cause stutters whilst "loading" itself into existence?
     
  2. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    Hi @Deeeds

    Currently this is not possible but it is something I have considered doing.

    It would only be the copying of data that can be done async. As with scenes, calling Awake and the other user callbacks have to run on the main thread, meaning that large Prefabs, just like large scenes, will cause some stuttering while awakening all objects.

    Cheers
    Steen
     
    Deeeds likes this.
  3. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    !!! THANK YOU !!!!

    No worries about having the callbacks operational, I (and everyone else, I imagine) will need their own usages of them, and will need to optimise as they can and see fit. My problem, not yours ;)

    Be absolutely wonderful to have async, I'm super happy you've been thinking about this, for two reasons.
    1. It's on the way.... part of the idea of Nested Prefabs...
    2. It means I'm not misunderstanding the potential of this (quite massive) feature of Nested Prefabs.

    Here were my (more) naive thoughts on this way, before I knew Nesting Prefabs could do this level holding/loading:

    Scenes With Transforms
     
  4. Harsh-K

    Harsh-K

    Joined:
    Oct 29, 2021
    Posts:
    5
    Any update ???