I have tried to configure the export of a simple project to webgl in unity3d but I am not sure how much memory I should allocate in the PlayerSettings
.
If I put 16 I get
If I put 60 I get
Experimentally I found that on localhost it works perfectly with 40
But I understand that it depends largely on the equipment that runs it (Mine has 16 gigs of RAM and a 1 Giga nVidia graphics processor )
Is there a way or formula to calculate the appropriate amount to work on the most computers? Do I need to change my settings when exporting to a hosting server ? Is there a way to dynamically allocate that memory and work on all computers?
Explanation
I found a solution that seems to work quite well for me, although it makes the game load slower than normal.
It is about making the generation of the game through a
script de Editor
. By putting@MenuItem("Build/BuildWebplayer")
it, I make the script appear in a Unity menu and run when I click it. I add the parameterALLOW_MEMORY_GROWTH
to it and set it to true so that the system automatically decides how much memory it needs, starting from the minimum required. I add the levels I want in a string array and specify the folder name, in my case it will beWebPlayerBuild
.Code