move gameobject in unity 2d
transform.position = new Vector3(transform.position.x + movespeed, transform.position.y);
move gameobject in unity 2d
transform.position = new Vector3(transform.position.x + movespeed, transform.position.y);
unity 2d how to move square with keyboard
public float speed;
void Update ()
{
// GetAxisRaw is unsmoothed input -1, 0, 1
float v = Input.GetAxisRaw("Vertical");
float h = Input.GetAxisRaw("Horizontal");
// normalize so going diagonally doesn't speed things up
Vector3 direction = new Vector3(h, v, 0f).normalized;
// translate
transform.Translate(direction * speed * Time.deltaTime);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us