Hello to everybody,
so im facing this error "Runtime Error: memory access out of bounds." when i run my webGL build on some mobile browsers.
----------
- These are my tests:
- Fail: Chrome for android, version
87.0.4280.101 (latest stable until now);
- Success: Firefox for android, version
84.1.1 (latest stable until now);
- Fail: Safari for iOS (latest stable
version);
- Fail: Chrome for iOS (latest stable
version);
- Fail: Firefox for iOS (latest stable
version);
- On desktop, works correctly on any
browser.
----------
How do i generate this error:
-----------------------------
Just by running a WWW or UnityWebRequest to download a file data like this:
byte[] data = null;
WWW www = new WWW(url);
yield return www;
if (www.error != null)
throw new Exception(www.error);
else
data = www.bytes;
print(www.text.Length);//Printing the text lenght give the error
print(data.Length);//Printing the bytes lenght doesnt give the error
Note: it happens only with files that are like 10/20MB or heavier, i've tried with a file that is less than 1MB and it works correctly on all the mobile browsers.
I already read that a solution should be by increasing the memory allocation / memory heap, but i didnt understand how.
i already tried this and many other ways:
----------------------------------------
var maxHeapSize = 256 * 1024 * 1024;
UnityEditor.PlayerSettings.WebGL.emscriptenArgs = string.Format("-s WASM_MEM_MAX={0} -s ALLOW_MEMORY_GROWTH=1", maxHeapSize);
and this too:
---------
UnityEditor.PlayerSettings.WebGL.memorySize = 1024;
But nothing changes, the error is still showing.
And yes, i tried even with UnityWebRequest but still same error.
----------
Ps: Actually i dont need to print the text lenght, but since i need to access to that string, the error will be given anyway even just for a simple access to the string.
----------
- My Unity3D version is: 2020.1.10f1
- Player settings > Other Settings:
![alt text][1]
- Player settings > Publishing Settings:
![alt text][2]
----------
Thanks to everyone who can help me.
[1]: /storage/temp/172902-other.png
[2]: /storage/temp/172901-cattura.png
↧