I have found that Unity debugger has been stoped
Installed it and it run and it doesnt run really, so I guess it is out of day by now.
So what would be the actual way to debug a game with vs code on Linux this days?
Or all will be print logging?
I have found that Unity debugger has been stoped
Installed it and it run and it doesnt run really, so I guess it is out of day by now.
So what would be the actual way to debug a game with vs code on Linux this days?
Or all will be print logging?
The unsupported “Debugger for Unity” is still dragging it’s feet for me. but it looks like I am using older version of microsoft c# extension, that might be a reasony why it hasn’t fully broken yet. I think It had some compatibility issues at one point so I downgraded it and didn’t touch since.
So in my current setup I have:
Since it’s still c# In theory it could be possible to debug standalone exported build using just the microsoft c# extension. Need to enable debug options during build and configure the vscode debugger launch settings. Il2CPP should probably be disabled as well. There is also a chance that this doesn’t work at all due to the way mono is embedded in Unity. From what I understand instead of being plain c# program with C# runtime as a base and loading some native libraries as extra, Unity has native C++ executable as base with mono being included using it’s embedding API. Having to export the build for debugging wouldn’t be as convenient as debugging directly in editor, but it would still be better than nothing. If anyone has tried this let me know.
There is also a third party fork of “Debugger for Unity” extension. It got a few more updates with fixes after official extension development stopped. Currently It isn’t very actively developed either. But there is a chance that 1 year old extension will be in less broken state than the official one (which hasn’t been updated for 2 years). Since it’s third party extension from single developer use at your own risk.
Fourth option is using Rider from Jetbrains. They advertise it as cross platfrom editor for Unity I would expect it to be functional. In general JetBrains development tools are considered quite good and worth the price. Haven’t used Rider and it’s Unity integration. But I have used their other tools for Java, Python, C++ , Rust and was satisfied with the quality.
So @karliss_coldwild I cant attach to the Unity editor and debut without building/exporting the proejct as a standalone project?
Cause if I try to do attach to debuger I get this
I gues not a lot of people use unity on Linux, so that is why the worflow is different than on Windows?
I mean, I have worked a lot of time a go with unity and monodevelop, the integration was just right… Im downloading monoeditor and see if it still works xD… (probably not?)
Please read my post carefully, your conclusions seem to be opposite of what I said. Attaching to Unity editor with VSCode works (at least it does on my system). Whether you have patience to get it working and whether I know all the details of my setup which makes it working is a different question. I don’t know if debugging standalone build works any better, I have haven’t tried that.
Could it be that you have installed VSCode using snaps or flatpak package? Sandboxing done by those packaging formats could easily cause issues like preventing it from finding Unity process. Try installing vscode using deb or whatever the native package format for your distro is.
From what I understand Unity dropped support for monodevelop long time, way before the VSCode extension support got dropped. Maybe the developers of monodevelop are still maintaining the integration with Unity, maybe it doesn’t work at all. If you try it let us know.
Ok tried whether my speculation about standalone build are true or not. Was able to get standalone build debug working in following way:
In build options enable “development build” and “script debugging”
[optional] in the build output folder edit build_folder/NAME_Data/boot.config . Change managed-debugger-fixed-port to the port value you want to use.
install mono debug vscode extension Mono Debug - Visual Studio Marketplace
Create the debug config in launch.json example below
start the executable
use the “mono attach” debug target
In the port field specify the same port you wrote in boot.config.
{
"name": "mono attach",
"type": "mono",
"request": "attach",
"address": "localhost",
"port": 123123
},
If you didn’t specify a fixed port in boot.config Unity will choose a random one each time. You can find out which port it chose in Player.log. Near the top there should be a line similar to:
Starting managed debugger on port 56189
Since it was somewhat generic mono debugger. I guess other tools which support debugging mono might work in similar way.
Couldn’t get standalone build debugging in launch mode working (only attach mode described above). It was complaining that that target executable doesn’t contain valid CIL data. I guess it makes sense since Unity is embedding mono inside a c++ executable instead of building regular .net executable.
One more note. Debugging standalone executable using Microsoft c# extension instead of “mono debug” one will probably not work since the documentation of it clearly states “Debugging support for .NET Core (CoreCLR). NOTE: Mono debugging is not supported.” I guess things might get slightly simpler with the tooling once Unity transitions to coreclr from mono.
Try to first to enable debugging in Unity explicitly. (with button on botton panel or by connecting to debug port with something like like mono debug extension)
It worked for me and after that unity debugger started working normally.
Great! Thanks a lot for this!