Skip to content

Attach to Unity Process #2

@hackerzhuli

Description

@hackerzhuli

Overview

We can only attach to Unity Editor now, but we can't attach to running Unity processes, even over the LAN on other devices, not on the local machine.

This capability can be useful some of the time, when people are debugging builds. Which is rarely needed in a typical Unity project, because most of the time you can and should debug in the Unity Editor, it will give you much more info, like scene hierarchy, you can inspect Game Objects, see console logs and also use a debugger.

The only time you have to debug in a build is that you have a bug that is not reproducable in Unity Editor, which is very rare. In that case, you may have to debug in a development build. That is perhaps less than 1% of the time while you're working on a Unity project, that is, in a year of development, you may spend a day or two try to debug a development build. In which case you can just use Rider.

So this case is actually quite rare and definately not a daily use case. That is why development of it will be postponed indefinitely.

Implementation

The only different as far as I can see now, is that for Unity Editor, you can easily find the IP address and port, because it is the same machine, and the port can be calculated by process id. But for Unity player processes, we can't find it in this way.

The real way to discover them is subscribe to a UDP multicast group, and receive info about the players. The specific detailed can be find here.

Once the IP address and port is determined, it is no different than attach to Unity Editor. Of course you need to display a list for user to select which player to connect to before launching the debugger with target ip address and port.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions