Unity 2D Наблизити камеру

 

Camera camera;
float a;

void Start()
{
  camera = GetComponent<Camera>();
  a = camera.orthographicSize;
}

void Update()
{
  if (Input.GetKeyDown(KeyCode.W))
  {
    a++;
    camera.orthographicSize = a;
  }
  if (Input.GetKeyDown(KeyCode.S))
  {
    a--;
    camera.orthographicSize = a;
  }
}