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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

WebGL performance

Discussion in 'WebGL' started by nsmith1024, Aug 9, 2018.

  1. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    869
    Hello,

    I had a game tester tell me that my Unity WebGL app runs very slow, and i see the same thing when i run it on another computer.

    Is there anything i can do to speed it up?

    Thanks
     
  2. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    How slow we talking about? If it's 1-2 fps slow, that means WebGL is running through software (on the CPU and not GPU) in which you can't really do anything to improve performance to an acceptable level. Perhaps ask the user if he can update his GPU drivers (browsers tend to disable GPU acceleration on old/buggy drivers).

    You can block those users though by setting the "failIfMajorPerformanceCaveat" flag to true when creating the webgl context (https://www.khronos.org/registry/webgl/specs/1.0/#WEBGLCONTEXTATTRIBUTES). Perhaps something Unity should be doing by default, but a discussion for a different day. :)
     
  3. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    869
    Yes I noticed too that my browser wasnt using the GPU, the only way i found out was by looking at the TASK MANAGER the selecting the performance tab, the GPU was at 0% the whole time.

    When i turned on the GPU then it was really smooth, without it was jerky.

    I had to go through a bunch of complicated steps to get it work, which i had to figure out by trial and error. Dont know if a typical user may be easily able to do that, or would even check if the browser was using the GPU at all.

    Windows can even turn on/off the GPU depending on which program you are running it seems, which makes it more complicated.

    Maybe users would think the game was just slow and crappy and move on....
     
  4. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    For what it's worth, we don't typically run into this problem (it often happens when a client is operating through some VM environment). What we do if we detect a user "should" be able to run WebGL but can't due to software rendering is show a prompt saying something along the lines of try a different browser (each browser has its own driver blacklist, so while one doesn't work the other often will), please update drivers, or call support (and support walks them through updating the drivers/switching browsers).

    I appreciate that might be a bit challenging when you're more of an indie, but I think it's probably at least better to block those users (using the method I described in my last post) and showing some kind of prompt explaining why instead of letting them run your game at 2fps.