How can I reset the addressables system entirely, unloading all assets from memory and un-initializing the system so it is ready to go again.
I want to be able to “soft restart” the game and have the game start again from the start as if it was just launched. I am cleaning up all of my stuff but I can’t figure out how to “clean up” addressables.
I’m not too sure about de-initializing Addressables itself, but the best way to ‘soft reset’ your game is to do what’s considered a ‘destructive’ scene load operation. This is when you load a scene like so:
public IEnumerator SoftReset()
{
yield return SceneManager.LoadSceneAsync(sceneName: "MainMenu",
mode: LoadSceneMode.Single);
var cleanupOp = Resources.UnloadUnusedAssets();
while (!cleanupOp.isDone) yield return null;
}
Depending on how much stuff is in memory, the Resources.UnloadUnusedAssets call will take a bit of time. But this will unload, de-reference and clean up anything that isn’t in DontDestroyOnLoad or the “MainMenu” scene.