Use Rigidbody when movement should interact with Unity physics.
private Rigidbody rb;
void Awake()
{
rb = GetComponent<Rigidbody>();
}
Unity 6 uses linearVelocity:
Vector3 movement =
new Vector3(input.x, 0f, input.y) *
speed;
rb.linearVelocity = new Vector3(
movement.x,
rb.linearVelocity.y,
movement.z
);
Apply forces in FixedUpdate:
rb.AddForce(
direction * force,
ForceMode.Acceleration
);