Is it possible to set the port for profiler manually? It seems like the port is set randomly between 55000 to 55500 by default.
I am trying to connect to AWS servers where the instance is running in headless mode. But based on the issues below, I can’t do a mapping for port ranges on ECS:
It is not possible atm - the ports range profiler uses for connection is fixed to the range [55000,55511].
Alternatively, you might try to use C# API to dump profiler file to some location on instance, then retrieve it from there and load in the Unity Editor.
@alexeyzakharov is there a way to retrieve/log the port in the application itself? If I run multiple windows standalone players simultaneously, it’s impossible to attach the profiler as far as I’ve been able to find. It’s random whichever instance Unity will find (and often break if you launch another instance)
This greatly diminishes the usefulness and efficiency of the profiler. I have to make 2 separate builds in 2 different folders of the exact same code and assets to profile.
The port should be in the first couple of lines of the player.log
Just look for “PlayerConnection Initialized” or “Multi-casting”
Work to be able to specify the port in the attach to player drop-down → dialog is underway, likely to land on 2021.1
That doesn’t work in the general case though, unless you have a trivially small project (and don’t work with colleagues, who have different computers?)
The port number needs to be known in advance and be guaranteed to be stable otherwise we cannot setup firewall rules
It seems to be the same between all editor instances (experimentally: two different 2019.4.14 editor instances with two different projects created the same port-number), i.e. they clash.
Which means that you have to keep closing projects and re-opening them to make it work again. But every time you close a project Unity blocks all use of autoconnect profiler - requires you to create a new build (not really documented, but multiple people have discovered and reported this, and it appears in forum threads eg since 2016: How to link profiler to webgl build? ). So you’re back to point 1 above.
Since WebGL builds cannot be profiled except using this feature, and this feature is currently broken, this is a set of bugs that I’d expect to see fixed in 2019 LTS, not wait another 1-2 years for an LTS that finally ‘isn’t broken’ for GL builds.
if you turn on the build option to connect to the profiler, Unity will output the port the profiler is using. I was able to use the port number here to create an SSH tunnel locally to port 55001 and then tell unity’s profiler to connect to 127.0.0.1 and that is working
Has there been any update on this issue? Not being able to specify the port the profiler runs on for standalone builds is making it impossible to profile unity dedicated servers.
sorry to necro this thread but we’re in a similar situation to MartijnGG - we’d like to connect the profiler to a remote server (on PlayFab) to try to diagnose a few things. Can we specify a single port for the profiler connection in 2021.3.x yet or is it still a range? Unfortunately every single port on PlayFab has to be opened individually.
Thanks for any help or advice on how to connect the profiler to a dedicated build hosted remotely.
There is change of this behaviour. You still cannot decide your ports but we decided to drop random selection of ports in favour of ordered assignment (55000 up). This means if you know you will have one instance of unity running it always will be 55000 if more you can easily just open few next ones.
We are backporting these changes. Currently we landed in 2023.1, 2022.2.0b13, 2021.3.13f and working on version 2020.
There is a lot more nice improvements inside this pack so I want to believe that whole experience with player connection will improve.
There is even more changes that we are working on and plan to backport.
hi, thanks for following up here about the profiler connection behaviour. The tweaks to the port assignment should be very useful in our situation so thanks for the updates - looking forward to the next release