Unity - How to write a console

I am adding AR camera to my unity project. I am using vuforia sdk for AR features. I want to handle a mouse / finger click on the screen and get the pixel position on the screen. I am writing below code. To check the pixel values, I try to log them to the console. But I can't see anything. AR has a .cs file named DefaultTrackableEventHandler.cs

. I changed it. I am running my application as a real android device.

DefaultTrackableEventHandler.cs

if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Began) {
        float x = Input.GetTouch(0).position.x;
        float y = Input.GetTouch(0).position.y;
        print("x " + x + " - y " + y);
    }

      

+3


source to share


1 answer


Use the class Debug

to write to the Unity console.

eg:.



if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Began) {
    float x = Input.GetTouch(0).position.x;
    float y = Input.GetTouch(0).position.y;
    Debug.Log("x " + x + " - y " + y);
}

      

+5


source







All Articles