Search Unity

Loading speed is too slow

Discussion in 'Addressables' started by zhuxianzhi, Dec 29, 2020.

  1. zhuxianzhi

    zhuxianzhi

    Joined:
    Mar 30, 2015
    Posts:
    122
    I tested Addressables and Resources. Resources are much faster, about 80%-100% faster.

    Resources load time: 00:00:00.2168990

    Addressables load time: 00:00:00.3991120

    Test environment
    Unity 2020.2.0f1 windows 64 IL2cpp
    Addressable: 1.16.15
    Other settings are default.

    Code (CSharp):
    1.  public void Load()
    2.     {
    3.         var stopwatch = new Stopwatch();
    4.         stopwatch.Start();
    5.         var o = Resources.LoadAsync<GameObject>("GameObject");
    6.  
    7.         o.completed += operation =>
    8.         {
    9.             go = Instantiate(o.asset as GameObject);
    10.             stopwatch.Stop();
    11.             Debug.Log("load time:" + stopwatch.Elapsed);
    12.         };
    13.     }
    14.  
    15.  
    16.  
    17.  
    18. public void Load()
    19. {
    20.     var stopwatch = new Stopwatch();
    21.  
    22.     stopwatch.Start();
    23.     asyncOperationHandle = Addressables.InstantiateAsync("GameObject");
    24.     asyncOperationHandle.Completed += handle =>
    25.     {
    26.         stopwatch.Stop();
    27.         Debug.Log("load time:" + stopwatch.Elapsed);
    28.     };
    29. }
    30.  
     
    Mockarutan likes this.
  2. Thermos

    Thermos

    Joined:
    Feb 23, 2015
    Posts:
    148
    When first call Addressable.xxxx, it will call Addressable.InitializeAsync(), that might take some time, you should exclude that by calling it manually.