While we're working through practical examples, we'll need a way to print out information and feedback to the console. The term for this is debugging, and C# and Unity provide helper methods to make this process easy. Whenever I ask you to debug or print something out, please use one of the following methods:
- For simple text or individual variables, use a standard Debug.Log(). Text needs to be inside a set of parentheses, and variables can be used directly with no added characters:
Debug.Log("Text goes here.");
Debug.Log(yourVariable);
- For more complex debugging, use Debug.LogFormat(). This will let you place variables inside the printed text by using placeholders marked with a pair of curly brackets. Each set of brackets contains an index, starting from 0, corresponding to a sequential variable.
In the following example, the {0} placeholder is replaced with the variable1...