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

Load Asset Synced?

Discussion in 'Addressables' started by IEdge, Oct 11, 2020.

  1. IEdge

    IEdge

    Joined:
    Mar 25, 2017
    Posts:
    51
    Hi guys. I want to load my asset synced. I'm using the following code but the editor freezes when I running it.


    It's posible to load assets synced?
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,816
  3. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    This was widely known as "expected result" so far, good to know that this is not the official position. If that was supported it would finally kill the necessity of a sync API that so many have already requested.
     
  4. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,816
    Wanted to pass along an update from the team. They are currently working on this, with team members currently exploring synchronous Addressables
     
  5. XCPU

    XCPU

    Joined:
    Nov 5, 2017
    Posts:
    145
    Would be nice that's for sure!
    Currently trying to do a Scene completely built at runtime, which spawns
    generic objects from pools which themselves load addressables.
    The main controller needs access to those addressables to get references,
    so everything has to wait. The more I try to put things outside the addressables
    the less the whole system is worth it.
    A single scene only uses about 20% of all addressables, so I didn't want them all loaded.
    Have ended up just using a "bool runFlag" at start of Update and FixedUpdate,
    Nobodies doing anything until everything is setup and initialized,
    then set them all true, fade in, everything Go at the same time!
    Likely better ways to do it, looks a bit messy but it works. Moving forward...
    That's my Use Case, using Local Groups but Remote would be the same problem.
     
  6. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    If you spawn everything under a disabled gameobject you will remove the need of the runflag at all, I don't think that a synchoronous api is needed there (the opposite btw, as it will freeze the application until everything is loaded for you).

    Runtime synchronous load is more useful for stuff like procedural generation and character customization, where you don't know exactly which resources will be used ahead-of-time, but still you don't want to load every-single-choice as it would be a waste of memory.
     
  7. XCPU

    XCPU

    Joined:
    Nov 5, 2017
    Posts:
    145
    I looked at spawning disabled, but ended up just moving the same problem up to another parent.

    just cleaning up the Code now... nice comment I just removed;
    // can't get Ref. because it hasn't loaded yet. damn async 5h1t! goodnight..