Game Development Reference
In-Depth Information
Figure 2-17.
Debug.Log
description in the Unity Scripting Reference
You'll see in the description that
Debug.Log
logs a message to the Unity Console, followed by an
example line of code similar to yours.
There is a second description with sample code for providing you with more information in case of
an error. Alter your line of code by adding the gameObject reference:
Debug.Log("HelloWorld!",
gameObject)
; press
+S to save, and click Play in the Unity editor. Now the “Hello World!” message
appears along with some additional information provided by the
Debug.Log
function (Figure
2-18
).
Figure 2-18.
Debug.Log
output in console with Object context