Search Unity

[0.8.4] Addressables dependens on PlayerPrefs in play mode tests

Discussion in 'Addressables' started by FKInno, May 13, 2019.

  1. FKInno

    FKInno

    Joined:
    Dec 13, 2017
    Posts:
    7
    I just found out that Addressables.InitializeAsync(); does not work properly when PlayerPrefs.DeleteAll(); is called before running the fist playmode test when using Fast Mode.

    Addressables - Unable to load runtime data at location UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[[UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData, Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].
    UnityEngine.AddressableAssets.Addressables:InitializeAsync()

    Its possible to work around this issue but it would be nice if this would be changed to be able to run tests with clean PlayerPrefs.
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Well, there isn't really a good way around that for us. We create a settings.json file to know how to load all the things. We can't (and don't want to) create this file in a fixed location in your project. So we need to use PlayerSettings to pass from the editor to the player, where that file is. For fast mode it's something like Library/com.unity.addressables/something/something/settings.json.

    So if you really need to clear PlayerPrefs, and use addressables, you can go through and copy out all the stuff we care about, clear prefs, then copy it back in. the main one being kAddressablesRuntimeDataPath (though there may be more)

    All in all, the point of player prefs is to pass data from the editor to the player. so for you to clear that when going into a play mode test, seems odd.