Search Unity

UnityEngine.AddressableAssets.InvalidKeyException

Discussion in 'Addressables' started by PhoenixAdvanced, Mar 28, 2022.

  1. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Hi,

    I have recently begun using addressables in my project, in order to reduce RAM usage (I am storing references to a lot of game objects in the editor).

    Everything is working fine, but I am intermittently getting the above error. This is my code:


    Code (CSharp):
    1.                    
    2.  if (cs.contentADD[i] != null)
    3.                     {
    4.                         var go = cs.contentADD[i].InstantiateAsync();
    5.                         while (!go.IsDone)
    6.                             yield return new WaitForSeconds(0.1f);
    7.                     }
    8.  
    I am getting the above error on the line with instantiateasync().

    I have tried deleting the addressables and rebuilding the library, selecting and deselecting the addressables, etc, etc, and nothing seems to work.

    Everything works fine when I load these objects as prefabs, and everything looks fine in the editor, etc.

    I am calling the above code in a coroutine, is it possible that there is some kind of issue where two instantiateasyncs run at the same time?

    That doesn't seem to be the case from what I can see though.

    Any ideas?

    Thanks!