Question by
wechat_os_Qy0xg-Vl6qvCgq6O27ipr_zGY · Mar 31, 2021 at 06:47 AM ·
assetbundlememory-leakaddress
Cannot Unload dependencies on a Prefab loaded by Unity Addressable System,How Can I Unload dependencies o a Prefab loaded by Unity Addressable System?
When I Unload a Prefab with dependencies(Sprites、Spines) with Unity Addressable System.
I cannot unload totally these dependencies ,they are still in the Unity profiler.
I've googled unity documents and still not work.
Can somebody give any ideas or thoughts to solve the problem?
So much grateful about that.
Addressable version :1.16.16 UnityVersion:2020.2.1f1c1
LoadCode
public async Task<(GameObject,AsyncOperationHandle<GameObject>)> InstantiateAsync(string path)
{
var full = GetPath(path);
await Addressables.LoadAssetAsync<GameObject>(full).Task;
var handler = Addressables.InstantiateAsync(full);
var go = await handler.Task;
return (go, handler);
}
UnloadCode
protected override void OnDestroy()
{
if (_operationHandle != null)
{
if (_operationHandle.Value.IsValid())
{
Addressables.Release(_operationHandle.Value);
}
}
if (this._operationGameObject != null)
{
Addressables.ReleaseInstance(this._operationGameObject);
}
if (this.uiRoot) this.uiRoot = null;
}
Comment