- Home /
Switched to 2020.3.3f1 -- No Debugger and UDP Error,Unable to Use UDP port for VS/Unity Messaging
Was using 2020.3.0f1 without issues. Windows 10, latest VS.
Switched to 2020.3.3f1 and now getting the error:
"Unable to use UDP port 56670 for VS/Unity messaging. You should check if another process is already bound to this port or if your firewall settings are compatible."
The exact port number changes when relaunched. This occurs with a new game, a game that was upgraded, and old games not on 2020.3.3f1.
Debugging in VS no longer works as will not sync up.
How get VS debugger working and no UDP message? ,Was using 2020.30f1 without issues. Windows 10, latest VS.
Switched to 2020.3.3f1 and now getting the error:
"Unable to use UDP port 56670 for VS/Unity messaging. You should check if another process is already bound to this port or if your firewall settings are compatible."
The exact port number changes when relaunched. This occurs with a new game, a game that was upgraded, and old games not on 2020.3.3f1.
Debugging in VS no longer works as will not synch up.
How eliminate the error and get VS debugging operational?
Additional info.
Deleted all VS files from game. No joy. Deleted from Package Manager VS Editor and Code Editor then reinstalled. No joy. Restarted computer after each action.
Still no joy. Then after numerous attempts to attach in VS, it suddenly started working. But still get the same error in game.
While the game error is UDP port 56222, the VS Attach to Unity shows port 56220. Are the ports settable / selectable in either Unity or VS?
Did you ever find a solution for this problem? I ran into the same issue with 2021.1...
Same here. 2020.3.15f2 . Some more infos, may be someone has observed similar things: No recent updates, yesterday no such message. I had 2 Unity Crashes yesterday evening where the VB Compiler didn't close in Taskmanager. Afterwards I didn't try to debug anymore. Looked more into it: In my case, my AV "Eset" uses the port. (Check in CMD with netstat -abo -p UDP and look up the Port number. in My case 56238. The find the PID at the end of line. Use that in Taskmanager detail to look up the Process behind that.) So it's not Unity or VS having a fault but using the same port like another connection. It's no solution yet but at least a hint.
Answer by the_Whizzkid · Aug 24, 2021 at 04:24 PM
This solution is "dirty" as it will be overwritten with updates. Handle with care.
Ok, so with the Info of my Comment above: You can change the port Unity is using in case of a conflict. In Visualstudio open the "VisualStudioIntegration.cs" Script. (Just click on the warning in Unity). Change in line 123 (might change in other releases) the Port number like i did. Restart VS and Unity. Unity then uses a higher port number which (hopefully) doesn't conflict with another.
private static int DebuggingPort()
{
123 return 56500 + (System.Diagnostics.Process.GetCurrentProcess().Id % 1000);
}
Answer by MikeWise · Nov 20, 2021 at 11:47 AM
Ok, I tried this, with version 2020.3.20f1, in my file the port number was 56000, changed it to 56500, saved it, and ran it and .... it changed back. Quit Unity Editor, changed it again, reloaded, it changed back.
So it didn't work - I guess.
Except here is the wierd thing. The error message "Unable to use UDP port 56214 for VS/Unity messaging" went away. So maybe it did work in some strange inscurtable way?
I don't know. This behavior is flaky but it is probably some flaky Windows-Unity Interaction.
Nothing weird about it. The UDP port number is that constant number, plus the process id of the editor. The process id is assigned by the OS when the process starts, so it will likely be different every time. What really should be done here is they should check if the requested port is in use, and if it is, modify the number and try again. I'm not sure why they aren't doing that here, but the workaround on the user side is to restart Unity so it gets a different process id, and therefore requests a different UDP port.
I do agree with all the rest you wrote but: "the workaround on the user side is to restart Unity so it gets a different process id, and therefore requests a different UDP port". No, it's not (always) that easy, I tried to restart unity for 5 or 6 times in a row and some times got the same UDP assigned, or another one which was already in use. Even restarting the OS didn't always help. I also saw that other users had a permanent problem with the error on another thread. Anyways, since I tried my "dirty" solution and wrote my comment I never had the issue again... and also seem to have worked for MikeWise. I know it doesn't make a lot of sense as the script apparently gets overwritten.
Same problem, Unity 2021.2.7f1 on Windows 11 (I know, I'm a crazy risk taker). Made Mike's change to "VisualStudioIntegration.cs" Script, it automatically changed back after Unity compiled and warned that the file shouldn't be changed... yet the problem went away for now.
Answer by justinmp · Feb 19 at 05:04 PM
Here is something interesting... I was dealing with this issue today and was almost done (typing up a big this stinks message) I am on 2021.2.12f1/Windows 10 (full patches) and VS 2019/2022 I kept getting this error even after setting all the firewalls and monitoring it with TCPView (systernals) and could not find any reason why this wasn't working... I reinstalled VS and the unity tools... then I went to my window/package manager and uninstalled the visual studio editor package and noticed that the visual studio code editor package was also installed... removed both reinstalled just the visual studio editor and like magic the message is now gone.
Blah, never mind.... open and closed it again, got the same error... and even when I don't get the error Visual studio wont connect anyways giving that "unspecified error"
I finally figured out what was causing it, apparently it was vmware, after uninstalling it everything works.
In my case it was VirtualBox, probably is something the virtual machine boxes do on windows
In my case it was VirtualBox, probably is something the virtual machine boxes do on windows
For me, I'm on Unity 2021.3.2f1. All I need to do is to disable all the Windows Firewall rules related to "Unity" (Unity Hub, Unity 2020.3.20f1 Editor, Unity 2021.3.2f1 Editor, etc.), even if the rules themselves are all allowing the connections to go through.
This, paired with Microsoft SysInternals TcpViewer and Resource Monitor on Windows 10 x64 Pro, I was able to confirm Unity no longer shows the warning messages.
Your answer
Follow this Question
Related Questions
Can't attach Visual Studio debugger to iOS device 0 Answers
Weird issues running my game through Windows App Certification Kit? 1 Answer
getting udp package info inside unity (GlovePIE) 0 Answers
Visual Studio 2015 debugger can no longer attach to Unity after installing RC3 1 Answer
App on android device crashes as soon debugger is attached trough VS Debug/Attach Debbuger Unity 1 Answer