Search Unity

Question Too many 'wasm-functions' events that occur every time I touch the screen

Discussion in 'Web' started by gosoon, Jan 3, 2024.

  1. gosoon


    Jun 9, 2023
    Bug - Many touches slow down gaming performance - Unity Forum
    Bug - WebGL executed through touch device, More touches per frame = big hiccups in performance for a frame - Unity Forum

    In recent months, WebGL Build games made with Unity have been experiencing massive lag when touching the screen with multiple fingers at the same time, and i still haven't resolved the issue.

    What I've noticed recently while testing various games for web browsers is that this issue only occurs in games made with the Unity engine (at least in the games I've tested).

    I'm constantly checking the 'Performance' tab in my browser, and the WebGL build generated by the Unity engine runs quite a few 'wasm-functions' whenever a touch event occurs. It does not appear in games not made with Unity.

    The problem is that there is a limit to finding out to this extent with my basic informations, and it is not clear exactly why the numerous wasm functions recorded in the log of the web browser's 'Performance' tab occur.

    In an empty project where nothing has been added, only 1 or 2 wasm functions are created when the screen is touched, so it is expected to be the result of converting the script written during the game production process.

    So, it seems that numerous wasm-functions inevitably occur in the process of creating a game, so is there really no way to fix this 'multi-touch lag' that occurs in the process of building my WebGL Build game for mobile?


    I am attaching logs recorded from a relatively lightweight project I created.
    You might not think that there are that many wasm functions triggered by touch events, but when you consider that I'm constantly touching the screen with multiple fingers at the same time... (and as the game gets bigger, the number of these functions increases dramatically).

    I think this problem may be a result of me not optimizing the game. Nonetheless, I've seen this issue occur in most Unity WebGL builds, so I'd like to see if there's some hope.

    Of course, this problem could be solved to some extent by using a different engine, but I would like to create a game for mobile browsers with Unity..!

    (Sorry again for my terrible English produced by the translator)
  2. gosoon


    Jun 9, 2023

    These are functions that are called every time a touch starts and ends...
    After checking, I was able to find out the names of these functions.
    "dynCall_iiii, TouchHandler(int, EmscriptenTouchEvent, MainLoop(), ExecutePlayerLoop().."

    At least I don't think I'll be able to figure out a solution by looking at this.