Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Let us know your feedback about the Global Illumination changes in the 2023.2 beta.
    Dismiss Notice
  3. Dismiss Notice

WebGL Delays

Discussion in 'Unity 5 Pre-order Beta' started by NoXlenS, Jan 22, 2015.

  1. NoXlenS

    NoXlenS

    Joined:
    Jan 14, 2015
    Posts:
    5
    I'm trying to develop a WebGL application on Unity and am trying to figure out how to reduce delays and improve performance so that using Unity for WebGL becomes practical.

    I noticed that when i run a simple WebGL app (its a simple spinning cube) exported by unity for the first time, it takes noticeably longer than subsequent times to load. Is this due to the assets it needs to download or something? It is also slower than the version I'm using from an external js html build, even at its best timing.

    Is there an optimal way to import (usually through fbx or ma files), create or export models, textures and animations to improve WebGL performance with Unity? Also, with the exported javascript from unity, can anything be done to optimise this (outside of simply minifying)?

    Or is the performance bottleneck due to the exporting software still being developed by Unity?

    EDIT: tried to upload but the files are too large =/
     
  2. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    592
    Hi,

    There's multiple factors to startup time for the first time; all assets & code need to be downloaded. Since we use ASM.JS, in firefox there's also another process, which is caching the aot'ed Javascript. Other browsers might have similar setups to cache "compiled" javascript. Firefox will actually tell you about it in the log (and be much faster on this part in subsequent runs).
    As for the javascript minification; if you switch on stripping to "strip bytecode", make a release (non-development) build with the slowest build option, minifaction is done for you and we strip away parts of the engine that aren't used.
     
  3. NoXlenS

    NoXlenS

    Joined:
    Jan 14, 2015
    Posts:
    5
    I see. Thanks for the reply!

    I'll keep experimenting with unity ;)
     
  4. SLASH24

    SLASH24

    Joined:
    Sep 20, 2012
    Posts:
    144
  5. liyong79623

    liyong79623

    Joined:
    Feb 2, 2015
    Posts:
    14
    I have built my game in webgl recently. i really worry about the huge asm.js code, about 3 millions lines of js code! i watched chrome allocate about 1-2G mem to load the huge js code. then the chrome memory decrease to normal level.
    maybe i am wrong,but the huge js file will cause huge client memory reqiurements and slow load delay?