Search Unity

WebGL "out of memory" + Unity 5.3.4f1

Discussion in 'Web' started by EParent, Apr 8, 2016.

  1. EParent

    EParent

    Joined:
    Feb 13, 2015
    Posts:
    36
    Hi,
    first, sorry for my bad english. It's not my native language.

    I build a WebGL (Developpment), but, I always have a message that says "out of memory" at a certain time of the game or the game froze and I have a pop-up message from the browser "Script not responding"

    I use Unity 5.3.4f1

    Build Settings - Publishing settings
    WebGL Memory size : 256
    Enable Exceptions : None
    Disable Data catching

    I tested my build with Firefox 45.0.1 ("out of memory" and "script not responding")
    I tested my build with Chrome 49.0.2623.112 m ("script not responding" and "out of memory")


    Build settings - Publish settings
    WebGL Memory size : 512
    Enable Exceptions : None
    Disable Data catching

    I tested my build with Firefox 45.0.1 ("out of memory" and "script not responding")
    I tested my build with Chrome 49.0.2623.112 m ("script not responding" and "out of memory")


    The problem of memory occurs when I will show the ranking for the game. I have a call to my server to receive informations about the top 7-8 players and the information about the player (his position in the ranking). I have other calls to my server and the information that I retrieve is more bigger than ranking.
     
  2. EParent

    EParent

    Joined:
    Feb 13, 2015
    Posts:
    36
    Finaly found it....
    remove while(!www.isDone) for yield www
     
  3. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Yes, you cannot do while(!www.isDone) in WebGL, as IO in JavaScript is asynchronous, and will not complete before you give back control to the browser. So the above will result in an infinite loop.
     
  4. EParent

    EParent

    Joined:
    Feb 13, 2015
    Posts:
    36
    Thanks for the information
     
  5. abgamers

    abgamers

    Joined:
    Dec 22, 2009
    Posts:
    97
  6. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    You can check www.isDone in you Update function, but you need to return control to the browser between calls to www.isDone. If you just a loop like "do while(!www.isDone)" it will never finish, as the browser does not get a chance to get control back and finish the download.
     
  7. ademin

    ademin

    Joined:
    Aug 29, 2016
    Posts:
    1
    How are you fixing this? I get "www is not ready downloading yet." With or without IEnumerator this happens. Should I separate the WWW from other code some way?