Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Question Is it possible to profile remote webgl app?

Discussion in 'Web' started by omanuke, Nov 13, 2023.

  1. omanuke

    omanuke

    Joined:
    May 5, 2017
    Posts:
    30
    I wanna profile webgl app on iphone which has crash issue because of out of memory.
    I built webgl app on Mac and it can connect to Unity Profiler from local chrome.

    From iPhone safari, can't.
    It shows
    [Warning] [blocked] The page at https://192.168.0.17:5500/_webgl/ was not allowed to run insecure content from ws://127.51.68.120:54998/. (_WebGL.framework.js, line 6924)​

    From remote chrome on windows, it can't also.
    It shows error
    WebSocket connection to 'ws://127.51.68.120:54998/' failed: ​

    Mac ver: Ventura 13.6.1
    Unity ver: 2022.3.9f1 silicon
    iPhone ver:15 Pro Max

    Any info is helpful.
     
  2. omanuke

    omanuke

    Joined:
    May 5, 2017
    Posts:
    30
    I forgot to mention that I stopped Firewall on Mac already.
     
  3. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,448
    Security measures disallow connecting to a WebGL Player, so directly attaching is only possible with Autoconnect Profiler and Build & Run but I think you should be able to Profile to a file with Profiler.logFile + Profiler.enableBinaryLog or for Memory Profiling, MemoryProfiler.TakeSnapshot()
     
  4. omanuke

    omanuke

    Joined:
    May 5, 2017
    Posts:
    30
    Got it. I'll try the functions in your second suggestion.
    Though, still I wanna know why Autoconnect Profiler doesn't work from remote machine.
    In the same machines it works, but from remote machine, it tries to connect with 'ws://127.51.68.120:54998/' (I think it trial of autoconnect profiler, isn't it?), so it doesn't work.
    If that IP is determined by the AutoConnect profiler logic, there is a way to configure it?
     
  5. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,448
    It's a general restriction of WebGL as a platform, the connection has to be established from the Player to the Editor, which means the Editor IP and process ID needs to be build into the Player (which Auto Connect does) and I'm not sure if then even needs to be established directly at the start (Which Build & Run does).
     
  6. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    448
    Would be worth investigating how to pass-along those two variables dynamically in -any- debug build. There's obviously a hook to create a custom UI for the console logs... why not have an input field to copy/paste the values and relaunch the application (if it has to be done at init)?

    The issue with Build & Run is that its rarely used in any serious WebGL application as those are deeply integrated with other Web Services. And those complex WebGL applications are what require the most profiling...
     
  7. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,401
    i noticed this issue on one computer that had multiple network connectors, it picked up the wrong IP (webgl browser console printed out that wrong ip), and was avoid by first disabling those additional connections on that pc..
     
  8. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,448
    Agreed. We had some requests into that direction before. You can help us prioritize that by adding your voice to our feedback database here via the Submit New Idea element.

    Also, you can set the values in the boot.config file of the build but yeah, that's not pretty in terms of UX.
     
  9. G_Wojo

    G_Wojo

    Unity Technologies

    Joined:
    Feb 8, 2017
    Posts:
    44
    In 2023.3 version we already resolved this issue. When connecting/sending IP it should send all the IP's. We right now backporting this to 2022.3.
     
    KamilCSPS and mgear like this.
  10. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    448
  11. omanuke

    omanuke

    Joined:
    May 5, 2017
    Posts:
    30
    For webgl build, I can't find boot.config file in the outputs of build.
    Under Library folder, I could find multiple boot.config files but I'm not sure whether editing those is correct&stable way and which file I should edit.

    Under build output folder, I checked frameworks.js and loader.js and index.html, but I couldn't find ip related code for AutoConnect profiler.

    Do you know where I should check?