How to Debug in Unity - Tutorial for Beginners
You want to make a game in Unity, but your player is not moving or triggering a collision? Well, in this video, we will learn something about Debugging in Unity. First of all, debugging is one of the first steps when making a game in Unity. It can determine whether a function is working or a value is changing. Since Unity uses the C# programming language, the syntax used for debugging looks like this - Debug.Log("message"); When making a game in Unity, there are many things that can go wrong and we don’t know how to fix them. The actual way to fix them is by learning how to Debug in Unity. Debugging is important for defining whether a value is increasing or not, it can be also used for detecting collisions or movement. However, Debug has some different ways to write messages in Console. Debug.LogError is used as a variant of Debug.Log for writing error messages, LogWarning is used for warning messages and LogException requires a try-catch block to tell if a program has an exception. Another kind of message is called assertion message and is written like this - LogAssertion(object message, Object context); When opening a C# script, if a Debug.Log is put in void Start(), it will be played at first frame only. Adding the same line into void Update() will display the message every frame, so it's better to use it only when a value is updated in an if statement. In order to check if your player is moving, use any playermovement script that was explained in previous videos and try to add these lines of code. Support the Creator of Kozmobot on the social networks! CHECK OUT MY WEBSITE: http://kozmobot.com INSTAGRAM: https://www.instagram.com/kozmobot.channel TIKTOK: https://www.tiktok.com/@kozmobot.channel
Download
0 formatsNo download links available.