using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Beyond { public class ImageResourceLoader : MonoBehaviour { public Image image; public string path; // Start is called before the first frame update private void OnEnable() { image.sprite = Resources.Load(path); } private void OnDisable() { Resources.UnloadAsset(image.sprite); //Resources.UnloadUnusedAssets(); } } }