

Gain +10 Debugging for Unity with Visual Studio
source link: https://devblogs.microsoft.com/visualstudio/gain-10-debugging-for-unity-with-visual-studio/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Gain +10 Debugging for Unity with Visual Studio
June 28th, 2021
So you’re ready to level up your debugging skills with Unity and Visual Studio? Check out our new video series in this playlist: Beginner Series: Intro to Visual Studio Tooling for Unity. This series focuses on common Unity troubleshooting scenarios and how you can use Visual Studio to find and fix them. Each video starts by highlighting an example problem, how you might solve it today, and then shows how to use Visual Studio and the debugger to solve it. By the end of the series, you’ll have several techniques in your toolbelt for tackling challenging bugs.
Hunt down that bug
The Unity Console is showing an error and you’re not sure where to start. You could start sprinkling Debug.Log
statements everywhere to narrow it down. However, follow this video to learn how a few basic features of the Visual Studio debugger can save you time. Learn about breakpoints and how they can help you target in on a specific line of faulty code.
Understand changing data in your game
Next, the series walks you through how to use the debugger to inspect variables and data in your game. These tools are helpful to understand how code is working so you can verify if it’s behaving as expected. Maybe that method for calculating player health isn’t doing exactly what you thought it was…
Explore and test with live data
You placed breakpoints and inspected variables. Everything looks right! And still the bug persists. You could edit the code, press Play in the Unity Editor, read a Debug.Log
statement and repeat. This video shows you how to save time by testing different values for a variable and watching how code responds in real-time.
Pause at the right time
In the first video, we learned about using breakpoints to stop execution when a line of code runs. However, you might find it unhelpful to stop every time that line of code runs. Instead, you may want to stop when a player’s health is below a certain value because that’s when you noticed the bug. This video dives into Conditional Breakpoints and how to use them to pause on a line of code at just the right time.
Fix issues on devices
It’s frustrating when your game works fine in the Unity Editor, but then you build and run on a device and there is bug. This video combines everything learned so far to show you how to use how Visual Studio to debug a Unity game that’s running on your desktop or other device.
New experience gained!
Congratulations, you earned +10 to your Debugging attribute! You explored Visual Studio debugger features like breakpoints, watches, data inspections and more to troubleshoot Unity games. These tools will save time and frustration when fixing bugs or tuning behavior in your games. If you’re just getting started, we also recommend visiting our documentation on Visual Studio Tools for Unity. As always, we love feedback. You can Suggest a Feature or Report a Problem directly from Visual Studio and Visual Studio for Mac from the Help menu. Visit Developer Community for existing issues and suggestions to upvote what’s important to you.
John Miller
Senior Program Manager, Visual Studio & .NET
Follow
Recommend
-
72
I recently wrote about My Top VSCode Tips and Tricks and among them was Debugging. In this article, I'll cover how to debug...
-
11
Dec 2, 2019 - 11 minute read - Comments - Burp
-
17
[Guest post] Learn C# with Visual Studio, Visual Studio for Mac, and Unity (and win a free book!)[Guest post] Learn C# with Visual Studio, Visual Studio for Mac, and Unity (and win a free book!)
-
12
WinUI 3.0 Debugging Tooling with Visual Studio Preview 4 of WinUI3.0 dropped recently and if you want to get started you’ll need the preview of Visual Studio and the WinUI project templates. One of the things I noticed was that...
-
10
Remote Debugging a .NET Core Linux app in WSL2 from Visual Studio on Windows Sponsored By With Visual St...
-
9
Play Async Debugging Part...
-
10
Description Isadora Rodopoulos, an engineer on the Visual Studio Debugging team, wraps up our mini-series on debugging async code.
-
9
Easier browser debugging with Developer Tools integration in Visual Studio Code Written By p...
-
6
在 Mac 下配置 Visual Studio Code 为 Unity 代码编辑器0 CommentsUnity 虽然附带了一个 MonoDevelop 作为代码编辑器,但是这个编辑器并不好用。经过半天折腾,...
-
2
Unity extension for Visual Studio Code – Now Generally Available Jb Evain
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK