how to make characters move in unity code example
Example 1: unity move with rigidbody.moveposition
rb2D.MovePosition(rb2D.position + velocity * Time.fixedDeltaTime);
Example 2: how to move a 2d character in unity
if (moveInput != 0)
{
velocity.x = Mathf.MoveTowards(velocity.x, speed * moveInput, walkAcceleration * Time.deltaTime);
}
else
{
velocity.x = Mathf.MoveTowards(velocity.x, 0, groundDeceleration * Time.deltaTime);
}