123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 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;
- }
- }
- }
|