unity movement wasd c#
using UnityEngine
public class Example : MonoBehaviour
{
public float speed = 10;
public Transform object;
public void Update()
{
float horizontalInput = Input.GetAxis("Horizontal");
float verticalInput = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(horizontalInput, verticalInput, 0);
movement = movement.normalized * speed * Time.deltaTime;
object.transform.position += movement;
}
}