unity 2d movement script using if statements code example
Example: unity move script if else
moveInput = Input.GetAxisRaw("Horizontal");
if (moveInput > 0.5 || moveInput < -0.5)
{
rb.velocity = new Vector2(moveInput * moveSpeed, rb.velocity.y);
}