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

Question Problems with Resources.LoadAsync massive spike

Discussion in 'Addressables' started by RubberBandGames, Jun 21, 2021.

  1. RubberBandGames

    RubberBandGames

    Joined:
    Jul 20, 2020
    Posts:
    170
    Hi,

    Hoping someone can direct me the right way, I've heard the Resource system is only good to quickly put something together, so this could be the reason why I am having these spikes.

    In short I have a ScriptableObject which contains all my networked objects, so that I can easily reference them later down the line, problem is when I call Resources.LoadAsync I get a massive spike, which seems a bit weird as it's suppose to be Async but it locks up the main thread (Could be the problem with the Resource system hence why they tell you to avoid it)

    So I doubt there is a simple fix for this, I was wondering if the Addressable system has this issue?
    How would I convert to use the Addressable system from the Resource system.

    Thanks,
    Tom
     
  2. RubberBandGames

    RubberBandGames

    Joined:
    Jul 20, 2020
    Posts:
    170
  3. You haven't really described too much about your system, so I will guess, I may be wrong.
    How much is "all"?
    If you feel it's easy, usually it's wrong. (okay, this is just a half-joke)
    If your "all networked objects" are numerous, the spike you see will be coming from the initialization of those objects (instantiation, awake, start, enable), everything at once for all of your objects.

    If you have a lot of objects it worth to load them in smaller bursts. And/or obviously minimize the initialization, if you are doing a lot of objects at once, you are choking the main thread. And it has nothing to do with if you're using async to load them or not. Also nothing to do with what system you're using to actually load them.