Hy. I trying to make a 2d game, I have a player and some UI buttons, When I press the Pause Button the player change his position, how can avoid this?
My code for player movement:
if (Input.GetMouseButtonDown(0))
{
started = true;
}
if (started == true)
{
targetFollow = Input.GetTouch(0).position;
targetFollow = Camera.main.ScreenToWorldPoint(targetFollow);
transform.position = Vector2.Lerp(transform.position, targetFollow, speed * Time.deltaTime);
}