Videogames Development – Unity – Debug.Log
Logs message to the Unity Console.
Statements:
// Message with a link to an object. Debug.Log ("Hello", gameObject); // Message using rich text. Debug.Log("<color=red>Fatal error:</color> AssetBundle not found");
SCRIPT
MAIN TOP MENU> ASSETS> CREATE> Javascript, type the name ‘GetMousePosition’
Assets> GetMousePosition> Inspector> ‘Open…’ button
Write:
#pragma strict function Start () { } function Update () { var mouse = Input.mousePosition; Debug.Log(mouse); }
Create an Object inside the Hierarchy ‘MyObject’
Assets> DRAG AND DROP ‘GetMousePosition’ script over Hierarchy> MyObject
Play> move the mouse, look at the BOTTOM OF THE SCREEN, you will see the coordinates as: (536.0, 583.0, 0.0)