@@ -4,30 +4,19 @@ Unity Debug Adapter (DA) for debugging the Unity Editor or applications using th
44backend.
55
66> [ !IMPORTANT]
7- > I am currently re-writing this project. There are a couple of issues and using dotnet rather
8- > than Mono to run this seems problematic.
7+ > debugging IL2CPP applications is not and will not be supported.
98
10- > [ !IMPORTANT]
11- > debugging IL2CPP applications is not supported.
12-
13- This project is adjusted (somewhat forked) from the deprecated and quite frankly bloated
14- [ vscode-unity-debug] [ vscode-unity-debug ] project. [ vscode-unity-debug] [ vscode-unity-debug ] does
15- not work out-of-the-box with new dotnet because of failure to detect the '\r\n\r\n' sequence
16- in client <-> debug-adapter messages. The failure is caused by an IndexOf("\r\n\r\n") issue
17- (see https://github.com/dotnet/runtime/issues/43736 ).
18-
19- Since the project is stale and no longer accepts pull-requests/patches, fixing
20- issues of the original [ vscode-unity-debug] [ vscode-unity-debug ] project and debloating
21- it are the reasons for the existence of this project.
9+ This project is adjusted (forked) from the deprecated and * quite frankly* bloated
10+ [ vscode-unity-debug] [ vscode-unity-debug ] project.
2211
23- Hopefully when Unity finally moves to .NET Core, the need for this repository will cease to
24- exist. In the meantime, if you are doing Unity development on a text-editor/IDE other than
25- VSCode, Ryder, or Visual Studio, and you want debugging functionalities with a clear license
26- (MIT) then this project is for you.
12+ If you are doing Unity development on a text-editor/IDE other than VSCode,
13+ Ryder, or Visual Studio, and you want debugging functionalities with a
14+ permissive license (MIT) then this project is for you.
2715
28- In case you are looking for instructions on how to hook this to Neovim, see [ neovim-unity] [ unity-debugger-support ] .
16+ In case you are looking for instructions on how to hook this to Neovim, see
17+ [ neovim-unity] [ unity-debugger-support ] .
2918
30- ## Installation
19+ ## Build from Source
3120
3221Clone the repo and its submodule(s):
3322
@@ -64,27 +53,93 @@ Then, if you want to run the debug adapter:
6453bin/Release/unity-debug-adapter.exe
6554```
6655
67- You should then be seeying an output like this:
56+ If you built this from source, you might need to:
57+ ``` bash
58+ chmod +x bin/Release/unity-debug-adapter.exe
59+ ```
60+
61+ You should then get an output like this:
6862
6963``` text
706421/08/2025 00:31:01 [I] waiting for debug protocol on stdin/stdout
716521/08/2025 00:31:01 [I] constructing UnityDebugSession
726621/08/2025 00:31:01 [I] done constructing UnityDebugSession
7367```
7468
75- ## Usage
69+ ## For Developers
7670
77- ` unity-debug-adapter.exe ` accepts two optional long parameters:
78- - ` --trace-level ` sets the logging trace level: ` trace ` | ` debug ` | ` info ` | ` warn ` | ` error ` | ` critical ` | ` none `
79- - ` --log-file ` provides a path to a log file. In case this is not provided, and ` --trace-level ` is not ` none ` , logging
80- is output to stderr.
71+ This section is mainly for developers interested in contributing or want to
72+ learn the intenals of this project.
8173
82- Example of an invocation:
74+ ### Overview
8375
84- ``` bash
85- unity-debug-adapter.exe --trace-level=trace --log-file=dap-log.txt
8676```
77+ Translates `requests` from nvim (which are DAP conformant)
78+ to Mono.Debugger-sepecific requests.
79+ Translates Mono.Debugger-specific
80+ responses to DAP-conformant `responses`.
81+ Writes logs to s_LogFile or stderr Locally running Unity Editor (which always uses Mono). Or
82+ | a local/remote running Unity Player instance using Mono
83+ | backend (with debugging enabled)
84+ | |
85+ +------+ +-----------+ +--------------------+ < - - - - - +
86+ | Nvim |----------- | UNITY DAP | ---------------- | UNITY |
87+ +------+ ^ +-----------+ ^ | (Mono.Debugger) |
88+ | | +--------------------+
89+ | |
90+ via stdin and stdout + via a TCP/IP socket (ip:port)
91+ (_outputStream and inputStream)
92+ ```
93+
94+ ### Backends
95+
96+ This debug adapter essentially communicates with the following backends:
97+
98+ - Mono.Debugger.Soft: this is the official Mono debugger in ` debugger-libs ` .
99+ - GDB: Mono applications can be debugged using ` gdb ` . This is still not
100+ implemented yet and is TODO.
101+
102+
103+ ### Why not IL2CPP
104+
105+ I will not include add support for debugging C# -> IL2CPP code mainly because
106+ of these facts/opinions:
107+
108+ - IL2CPP is closed source and I might get into trouble if I implement something
109+ like what Visual Studio does (i.e., some sort of mapping between original C#
110+ code and generated IL2CPP C++ code).
111+ - I think it makes little sense to debug C++ code (generated or not) via
112+ stepping through a completely different language (e.g., managed C#).
113+ - Complexity. There are very few people who are using Neovim for Unity, fewer
114+ are using debuggers, and even fewer who want to debug IL2CPP through C# via
115+ Neovim. This is simply not worth the effort.
116+ - IL2CPP is simply C++. Just debug it using a proper C++ debugger (e.g., gdb).
117+
118+ ### Why Not Use [ vscode-unity-debug] [ vscode-unity-debug ] ?
119+
120+ [ vscode-unity-debug] [ vscode-unity-debug ] does not work out-of-the-box with new
121+ dotnet because of failure to detect the '\r\n\r\n' sequence in
122+ client <-> debug-adapter messages. The failure is caused by an
123+ ` IndexOf("\r\n\r\n") ` issue (see https://github.com/dotnet/runtime/issues/43736 ).
124+
125+ Since the project is stale and no longer accepts pull-requests/patches, fixing
126+ issues of the original [ vscode-unity-debug] [ vscode-unity-debug ] project and
127+ debloating it are the reasons for the existence of this project.
128+
129+ The project is also very poorly written, all responses are sent twice, the
130+ project relies on heavy usage of the ` dynamic ` keyword which requires JIT and
131+ which causes issues when this project is compiled with dotnet (rather than
132+ xbuild).
133+
134+
135+ ### In an Ideal World
136+
137+ Hopefully we get Unity .NET CLR support before the sun explodes so that we can
138+ use actual proper, industry-standard, open-source, and actively maintained
139+ .NET debuggers.
87140
141+ When that happens, this adapter will add support to it and will, probably, be
142+ much more useful.
88143
89144## License
90145
0 commit comments