Im using UnityWebRequest to load an image.
This is the code.
UnityWebRequest uwr;
StartCoroutine(LoadImageCorroutine());
IEnumerator LoadImageCorroutine()
{
using (uwr = UnityWebRequestTexture.GetTexture(@"file:///C://UnityTests/Filerepository/Items/3faju5ozafrz.png"))
{
yield return uwr.SendWebRequest();
rawImage.texture = DownloadHandlerTexture.GetContent(uwr);
//Debug.Log(i.ToString());
}
uwr.Dispose();
StopCoroutine(LoadImageCorroutine());
}
I ran some performance test and noted that the Memory usage where going up and up each time I called the coroutine and didnt go down afterwards.
Considering the CPU load going down with time, it seems the coroutine either properly stopping or at least going idle.
How do I get rid of whatever UnityWebRequest is loading into my Memory?