Better alternatives to VS for debugging?

Is it just me or debugging a complex piece of code in VS is really a complete pain in the neck?

I’m sick and tired of trying to debug a complex piece of code with VS 2019/2022. Setting breakpoints in multiple files is a cumbersome task. Sometimes you set a breakpoint and VS just shows a warning sign on the break point saying it won’t be hit, you have to detach from Unity and reattach again in order get rid of the warning sign and get the breakpoint actually working. Sometimes that’s not enough and you need to close VS and open it again to get the breakpoint working. Often breakpoints set on the fly just show the warning sing and won’t trigger, you need to detach from Unity and re-attach in order for the breakpoint to really activate them, which often times means losing track of the status data you’re trying to debug. There are times when a breakpoint just stops triggering and you don’t realize, and after a while, suddenly it just starts triggering again when you no longer need it. If you make changes to one file, breakpoints on other files stop triggering, again you need to detach and reattach in order to get them working again. You cannot simply set a breakpoint and expect it will work all the times, so you are forced to figure out all possible breakpoints you may need before going into play mode your game, because like I said, most times setting breakpoints while the game is playing won’t work… and don’t dare to modify anything while the game is playing because that will cause some breakpoints to stop triggering next time you play the game, so every time you want to play your game you need to check all break points one by one to make sure the nasty warning sign isn’t there, and detach and reattach, and if that doesn’t work, close VS and open it up again, which is really annoying and completely impractical.

Any alternatives? advise?

Our group has volunteered to simply stop writing bugs and this seems to work pretty well so far.

In seriousness, I hear you, and yes, the issues you note above are a real thing, especially in Windows.

There does not seem to be any official “oh yeah it’s bad, we’re fixing it” forthcoming from Unity, so I wouldn’t expect that to change anytime soon. I find it hard to believe people at Unity are not suffering too when they debug.

On the Mac, at least Intel Mac, debugging has become fairly solidly buttery smooth. I rarely get issues, except when perhaps I have two or three Unity instances open and running and VS gets confused as to which codebase it is watching.

From time to time third party packages will screw up debugging. For instance, from 2016 to 2017 the mere presence of the GameSparks plugin (which was freakin’ NOTHING, just a stupid REST call wrapper) would completely prevent you from debugging. Firebase / Crashlytics is also like this, causing ceaseless issues with their attempts to be “smart” and to validate GUIDs and other identifiers every time you go in and out of play mode.

My only suggestions are:

  • reboot your Windows machines at least once a day (yes, in 2022 this is still the case, as it was in 1985… plus ca change, etc.)

  • preferentially try to get the info you need from Debug.Log() output, which has the important advantages that a) it always works, and b) it does not freeze your interactive game

  • don’t use packages that cause problems with debugging, such as Firebase / Crashlytics

  • oh yeah, and don’t write bugs. :slight_smile: No seriously, I think the value of write-a-bit / run-a-bit / back-n-forth is essential with interactive software development. Don’t write the entire class and package without testing. For instance I test-play my games almost every 5 to 15 lines of code written. This drastically reduces the amount of “test surface” where your bug could be hiding, but obviously is not a panacea.

EDIT: as Smithy says below, some folks on my teams have had better luck with Rider. I have not personally used it more than superficially on a trial basis.

1 Like

I had similar experiences with VS and decided to give Rider a try: https://www.jetbrains.com/rider/

Its not free but it’s a great IDE with a robust debugger, so I’ve not looked back.

2 Likes