Hello, i am a begginer to Unity and i was making animation first with my character then i added the ability for him to move but he doesent wana move with the script or in the scene view
the movement script is very much the same as the one of CodeMonkey
void Update () {
float speed = 15f;
float moveX = 0f;
float moveY = 0f;
if (Input.GetKey(KeyCode.D))
{
moveX = 15f;
}
if (Input.GetKey(KeyCode.A))
{
moveX = -15f;
}
if (Input.GetKey(KeyCode.W))
{
moveY = 15f;
}
if (Input.GetKey(KeyCode.S))
{
moveY = -15f;
}
Vector3 moveDir = new Vector3(moveX, moveY).normalized;
transform.position += moveDir * speed * Time.deltaTime;
}
↧