Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Is it possible to play a WebGL Unity-Game on smartphones browsers?

Discussion in 'Editor & General Support' started by Oliver_liferadio, Apr 19, 2024.

  1. Oliver_liferadio

    Oliver_liferadio

    Joined:
    Apr 19, 2024
    Posts:
    2
    Hello,

    I am currently working on the development of a 3D Unity game and plan to export the game as a WebGL version. So far the game runs smoothly when I open it in a browser on the PC.

    However, I have noticed that the game does not run as smoothly on smartphones in the browser and often stutters. The performance varies depending on the smartphone, some devices perform better, others worse.

    After my research, I learned that Unity WebGL is not optimally supported on smartphones. I've also heard about the possibility of using WebAssembly, but I'm not sure exactly how that works. (Does a WebGL build automatically run as WebAssembly if the browser supports it?)

    I'm currently facing the challenge of exporting my game as a WebGL version so that it works smoothly on smartphones in the browser.

    Does anyone have any experience or information on how I could solve this problem? Any help would be very helpful.

    Here is some general information about my project:
    Unity Version: 2022
    Scene details: about 15.000 tris and 15.000 verts
    Render-Pipeline: Universal Render Pipeline (URP)
    Project size: 3,5 GB
    Build size: 12 MB

    Thanks and best regards
     
  2. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    2,168
    of course you can, i have a bunch.. just export as webgl if game is suitable it runs, yes there are limitations, but they can run..
     
  3. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,922
    Unity 6 is the first version that officially supports WebGL for mobile. It already works well in 2022.3 though.

    In any case you will have to come to expect WebGL significantly underperforming compared to a native app. This is true for any platform but even more so for mobile. Test frequently, profile often.
     
  4. Oliver_liferadio

    Oliver_liferadio

    Joined:
    Apr 19, 2024
    Posts:
    2
    Hello again!

    Many thanks for the quick answers. This has already helped me.

    Do you have any other recommendations regarding performance parameters or settings that I should choose when exporting?

    I also wanted to ask:
    Does using particle systems have a strong impact on performance, since I use some of them in the game?
    Is the resolution of the images important? I used high resolution images, but I scaled down they directly in Unity in the Inspector under "Override For WebGL".

    Thanks and best regards
     
  5. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,922
    It's hard to give general recommendations. Just make sure you build and test often on a device, and use the profiler (even from within the editor) to find possible areas of optimization. And use source control so you can backtrack any changes you've made.

    Also check this thread and the first linked thread with build size optimizations.

    One thing NOT to use on WebGL: MeshCollider on objects that are being instantiated. The more complex the MeshCollider the longer it takes to instantiate, and even a single instantiate can cause frame drops (use pooling or in-scene placed).