[Reposting this from the general support forum]
So, yeah, I feel kind of dumb asking for help on this subject because I’ve been using the profiler ever since I got my hands on Unity. The thing is that after building the webgl project I cannot connect the profiler to the project running on the browser.
Having webplayer as target was easy: you checked the autoconnect option, set the target to development on the context menu and you were good to go.
But in webgl build there’s no context menu (or I am unable to activate it) so I don’t know how to make it connect to the profiler. So when I hit build and run and firefox runs the project nothing happens on my profiler.
I’ve seen a couple threads of ppl having performance issues (which is what I am facing here) and all they get is the “use the profiler” response, and that’s exactly what I’m trying to do but damn sure I can’t make it work. Is there anything to do other than checking the autoconnect option during the build process?
Thans for your help guys.
As stated in the docs (on this page: Unity - Manual: Build your WebGL application) you must enable “Development Build” and then tick “Autoconnect profiler” as well. It’s right there in the Build Settings window:
i tried exactly what you said and what it tells you to do as well liortal. then what, does it only work from “Build & Run”?
I did that and the profiler did not connect…
Yeah, I did exactly that… and It didn’t work. But thanks anyway for taking the time to answer.
As I said, I’ve used the autoconnect feature in the past with webplayer builds. The thing is that when you use autoconnect, the Active Profiler dropdown list of the profiler should show the instance of your browser that is running the project. But in this case it doesn’t. I attached a picture of the Active profiler dropdown list (the 127.0.0.1 is my failed attempt to connect to the firefox instance).
Also, with webplayer build, you needed to alt+right click to bring up the context menu and select the deployment target and set development as the target, as that would connect your browser instance to the profiler. But in this case, it doesn’t happen (because I haven’t been able to bring up that menu).
And I do it always using the build and run button, since the docs say that it is not possible to connect to a running instance of the project in a browser.
So I run out of ideas. Maybe I need to alter the web template? Anyone?
I just read the release notes for the latest beta version here and it says:
- Profiling WebGL works with Firefox, but not Chrome
And comparing those release notes with the previous ones I believe that profiling may only be used in the latest beta release. If I’m wrong, please, correct me. I’ll download the beta and try to confirm this.
Confirmed.
Profiling WebGL with Firefox works on 5.1.0b3. No need to do anything.
I just created a blank scene, built and run, and profiler started dumping info. NOTE: The Active Profiler dropdown list doesn’t show the instance browser that is actually running the project, it just shows the info, but not where it’s getting it from .
In Unity 5.0, profiling was broken on windows. That is fixed in 5.1. I actually think it should work in Chrome as well, and that that release not is wrong, and probably stems from confusion from other issues, but I have to investigate that.
Yeah, forgot to mention I’m on Windows. Thanks for the response.
Andres did you find a solution in 5.1? I can understand at all, how to connect profile to WebGL build uploaded to FTP
Working with Web Player everything is clear - I see an option in Profiler to connect to web player, but not with WebGL
I did not check with any final version of 5.1 but since it worked in 5.1b I believe it works now. The way to use it is by hitting build and run (to run it locally). It doesn’t work on builds uploaded to the web. Again, if they didn’t change it, the info will be dumped to the profiler without any hint of where it is coming from, but it should be the local instance of your browser.
Build & Run should not be necessary, it should also work from an arbitrary server (all Build & Run does is start a server to make your life simpler).
But: You have to select “Autoconnect Profiler” to make the WebGL player connect to the editor. It does not work the other way around (like in other platforms, where the editor can connect to the player instance), because WebSockets don’t allow a browser page to host a server other clients can connect to.
My bad. Since last time I tried (5.1.0b3 on Windows) It didn’t work deployed on a server, I guessed it remained the same. Good to know that it’s fixed.
Actually I did the same:
- choose development build + autoconnect profile
- upload all content to FTP
- starting WebGL build in a browser (Chrome/Firefox)
nothing happens… Editor is running in that moment
Do you have the profiler window open? (It won’t open automatically). Also, if you open the browser console or network tab, are there any messages about connecting to a WebSocket host?
I got such error in Chrome Inspector (Profiler in Editor is active)
Ok, this looks like the browser cannot connect to the WebSocket host in the editor. Is this 5.1? Does restarting the editor help? Or restarting windows (maybe an old instance of the websockify bridge is running and blocking the port)?
I have tried everything you mentioned. No result. Unity version is the last one - 5.1.1f1
May be I need some WebSocket package imported to Unity?
I’m getting a similar WebSocket error with 5.3 in Chrome
I have the same problem in Unity 5.4, I can’t connect to profiler, I’ve tried everything, disable firewall, restart ect…
“WebSocket connection to ‘ws://192.168.0.13:54998/’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED”
mine says Firefox can’t establish a connection to the server at ws://10.5.50.87:54998/. can anyone help?