Sunday, 8 February 2015

this.gameObject.name and Input.GetAxis

Learned that you can:
Use Input.GetAxis("Mouse X") and Input.GetAxis("Mouse Y") to get the (X,Y) of mouse.
Use this.gameObject.name to print out the object name.
Both works when running on Mac.

void Update () {        
   print(this.gameObject.name+" Input.GetAxis(Mouse X)= ("+Input.GetAxis("Mouse X")+""+Input.GetAxis("Mouse Y")+")");
}


Was going to try and deploy to iOS, but gets this warning: "Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices." so might not be a good idea then.


No comments:

Post a Comment