Search Unity

Resolved Development-Build with Autoconnect Profiler unable to connect to the Unity Profiler

Discussion in 'Web' started by Gluttonium, Dec 8, 2021.

  1. Gluttonium

    Gluttonium

    Joined:
    Aug 19, 2021
    Posts:
    31
    I created a WebGL development-build for testing purposses, with the Autoconnect Profiler enabled in the buildsettings (you cannot attach to a running player built with WebGL, therefore the Autoconnect profiler is used). Choosing to 'build' instead of 'build & run' results in a working application that I run locally using a npm http-server. However... connecting to the Unity Profiler is another story. Because Autoconnect Profiler was enabled, to my understanding, the profiler should give you the option to connect to the running instance (which should be shown in the Attach to Player drop-down of the Profiler window). This isn't shown though. Now I like to clarifiy that this happens regardless of browser choice (Chrome, Firefox).

    Opening the browser devtools gives:
    Connecting directly to Ip=[IP], port=[Port].
    WebSocket connection to 'ws://[IP]:[Port]/' failed

    In another forumpost from 2015 I found that the port that is used varies between 54998 and 55511 and is hardcoded into the WebGL build. Which results into not being able to close or restart the Unity instance used to build the application. I do not know how legitimate this claim is nor if It would still be an issue, but there is that...

    I would like to be able to build the application, save it, to be used for profiling on multiple occasions on the same pc it was build on and make it connect to the Profiler. Any insight on how to do this would be helpful, the documentation is quite sparse.

    Used:
    Unity 2019.4.0f1
    Chrome 96.0.4664.45 (64-bits)
     
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,454
    Hi :)
    Due to restrictions of the WebGL platform, you can only connect to it right from the start, so only Build & Run with auto connect profiler works.
     
    mc_fragezeichen and Gluttonium like this.
  3. Gluttonium

    Gluttonium

    Joined:
    Aug 19, 2021
    Posts:
    31
    Thanks for the info, I find it rather odd that, that isn't specified within the Unity Docs. It is portrayed as if one would be able to autoconnect the profiler even after the build has been created.;)
     
    WildStyle69 and mc_fragezeichen like this.