using System.Collections; using UnityEngine; using YooAsset; namespace GFGGame { public class AssetReleaser : MonoBehaviour { private string _resPath; public string resPath { get { return _resPath; } } private AssetOperationHandle _handle; public void SetRes(string resPath, AssetOperationHandle handle) { Dispose(); this._resPath = resPath; this._handle = handle; } private void OnDestroy() { //if (!string.IsNullOrEmpty(resPath)) //{ // GFGAsset.Release(resPath); //} // resPath = string.Empty; Dispose(); } private void Dispose() { this._handle?.Release(); this._handle = null; this._resPath = null; } } }