Compilation errors and the console
Debugging typically refers to error-busting techniques for runtime use; that is, it refers to the things you can do to find and correct errors when your game is running. This understanding of debugging, of course, presupposes that your code is already valid and compiled. The implicit assumption is that you can write valid statements in C# and compile code, and you just want to find runtime errors that occur as a result of program logic. Thus, the focus is not on syntax but on logic, and this is indeed true. However, in this section, I'll speak very briefly about code compilation, about writing valid code, and using the console to find and correct errors of validity. This is important, both to introduce the Console window generally and also to establish a firm basis of thinking about debugging in more depth. Consider the following code sample 2-1 script file (ErrorScript.cs
):
01 using UnityEngine; 02 using System.Collections; 03 04 public class ErrorScript...