when i use this function with button , player change his position one time
i use this function with event trigger.
public void right(){
this.transform.localPosition += transform.right * oxspeed * Time.deltaTime;
}
when i use this function with button , player change his position one time
i use this function with event trigger.
public void right(){
this.transform.localPosition += transform.right * oxspeed * Time.deltaTime;
}
Why cant you just use
if ( Input.GetKey(KeyCode.RightArrow) )
//move right
You can change the input options in the Input menu from WASD to the arrow keys.
In your script you can also listen for specific keys, like so:
Update()
{
if ( Input.GetKey(KeyCode.UpArrow) )
//move up
if ( Input.GetKey(KeyCode.DownArrow) )
//move down
if ( Input.GetKey(KeyCode.RightArrow) )
//move right
if ( Input.GetKey(KeyCode.LeftArrow) )
//move left
}