Files
beyond/Assets/Scripts/UI/ImageResourceLoader.cs
2024-11-20 15:21:28 +01:00

25 lines
559 B
C#

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<Sprite>(path);
}
private void OnDisable()
{
Resources.UnloadAsset(image.sprite);
//Resources.UnloadUnusedAssets();
}
}
}