I am using Unity 2020.3.38f1, have this error when running the webgl build.
Out of memory. If you are the developer of this content, try allocating more memory to your WebGL build in the WebGL player settings.
What I am doing is load one image (around 500kb size) at runtime, I use the following code, it works when I run on Unity Editor, but fail with the above error when running on Webgl build.
private IEnumerator GetTexture(string imageUrl)
{
using UnityWebRequest uwr = UnityWebRequestTexture.GetTexture(imageUrl);
_currentWebRequest = uwr;
yield return uwr.SendWebRequest();
if (uwr.result != UnityWebRequest.Result.Success)
{
Debug.Log(uwr.error);
uwr.Dispose();
}
else
{
var tex = DownloadHandlerTexture.GetContent(uwr);
myIcon.sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 100.0f);
//Now we are able to click the button and we will pass the loaded sprite :)
myIcon.gameObject.SetActive(true);
myButton.interactable = true;
uwr.Dispose();
}
}
Does anyone have idea how much memory limit is for the webgl? And how to configure it?
Thanks a lot