Дивитися назад/вперед (Flip)
bool LookRight = true;
float x;
void FixedUpdate()
{
x = Input.GetAxisRaw("Horizontal");
if (x < 0 && LookRight == true)
{
Flip();
}
else if (x > 0 && LookRight == false)
{
Flip();
}
}
void Flip()
{
LookRight = !LookRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}