using System.Collections; using UnityEngine; namespace GFGGame { public class AssetReleaser : MonoBehaviour { private string _resPath; public string resPath { get { return _resPath; } set { if (_resPath == value) return; this.OnDestroy(); _resPath = value; } } private void OnDestroy() { if (!string.IsNullOrEmpty(resPath)) { GFGAsset.Release(resPath); } // resPath = string.Empty; } } }