microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
227 stars 11 forks source link

Search remote device players #975

Closed Merichbier closed 7 months ago

Merichbier commented 7 months ago

Type: Feature Request

When using the command Attach Unity Debugger, only the local players are listed. However when manually editing the launch.json it is possible to attach it to the remote player (we still need to figure out the port...).

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Attach to Unity",
      "type": "vstuc",
      "request": "attach"
    },
    {
      "name": "Attach to HL2",
      "type": "vstuc",
      "request": "attach",
      "endPoint": "169.254.206.164:56455"
    }
  ]
}

Note that I'm using the Ethernet IP of the HL2.

Would be cool that Attach Unity Debugger list the remote devices.

Extension version: 0.9.4 VS Code version: Code 1.87.0 (019f4d1419fbc8219a181fab7892ebccf7ee29a2, 2024-02-27T23:41:44.469Z) OS version: Windows_NT x64 10.0.22631 Modes:

jbevain commented 7 months ago

Hello @Merichbier,

The way things work is that a Unity player uses UDP multicast to send frames regularly that IDE and debuggers can use to know where the Unity players are on the network.

It's common that firewalls or routers prevent UDP multicast, and it's not something very easy to diagnose unfortunately.

But yeah, the command Attach Unity Debugger listens on UDP multicast for remote players too, so if you're not seeing it, it might be a network issue.

CC @sailro.

Merichbier commented 7 months ago

Hi @jbevain , Thanks for the extra information. I've double check the firewall on my laptop and the same rules are applied to VS Code and Rider regarding UDP (all inbound connection allowed for those applications). In Rider, the HoloLens device is discovered being through the WiFi IP address (device not connected with USB to the laptop) or the Ethernet IP address (when connected with USB). This makes me think it is not a network issue and don't know what else it could be. Any other ideas ?

Thanks again for the support

jbevain commented 7 months ago

@Merichbier I assume your HoloLens app is a UWP app, correct?

Merichbier commented 7 months ago

@jbevain Yes correct. However I need to take back what I wrote yesterday. It is definitively an issue on my laptop (firewall). Just for testing, I setup a new firewall rule (UPD, always accept, all port, any apps) and surprisingly, VS Code then detect the HoloLens correctly. I still don't know why the single rules (UPD, always accept, all port, VS Code only) isn't enough. Since the issue is as you first stated on the network, we can close this issue. As a feedback, it would be good to write some words about remote connection in the Unity Extension details :)

jbevain commented 7 months ago

@Merichbier hm that's a good catch. One likely reason is that the Unity extensions creates a subprocess that does the detection and returns the results back to the VS Code interface. I'm going to go ahead and close this, but feedback absolutely taken. We'll also have a look at whether it makes sense to move the detection code to TypeScript/VSCode.