One of my addressables fails every single time I do a change to any script, this fail causes Unity to completely freeze up, and I have to kill it via TaskManager.
The AssetReference used to load the asset is valid, and there has been no change to it, it just simply can’t load it. I get no crashlogs or anything, just complete lock-up.
Hi @Pixygon what Addressables version is being used? Also can you share the code used to load the asset?
Addressables version 1.20.5!
This works perfectly fine, as long as i haven’t made any script-changes or added any scripts!
public static async Task<GameObject> LoadGameObject(AssetReference reference, Transform parent = null, bool addSelfCleanup = true) {
GameObject go = null;
if(reference == null) return null;
var obj = Addressables.InstantiateAsync(reference);
obj.Completed += obj => {
switch (obj.Status) {
case AsyncOperationStatus.Succeeded: {
go = obj.Result;
if (go == null) return;
if (addSelfCleanup) go.AddComponent<SelfCleanup>();
if (parent == null) return;
go.transform.SetParent(parent, false);
go.transform.localPosition = Vector3.zero;
break;
}
}
};
await obj.Task; //<-- This is where the editor freezes up completely!
return go;
}
@Pixygon Hmm the code seems to compile and run on a new project. Maybe there’s something wrong with SelfCleanup.
It freezes before it completes, so it runs none of the things in the switch-statement.
As mentioned, it runs fine as long as I haven’t done any code-change, and it seems very weird that it would break only if i do a code change… and that codechange can be anything in the project, just a little comment breaks it…