using UnityEngine; public class CameraZoom : MonoBehaviour { void Start() { Camera.main.orthographicSize = 6; } void Update() { float wheelInput = Input.GetAxis("Mouse ScrollWheel"); //Mouse wheel의 움직임에 따라 wheelInput의 값이 달라짐 if (wheelInput > 0) // wheel을 위에 방향으로 { Camera.main.orthographicSize = Camera.main.orthographicSize - 1 ; // Camera size 줄이기 = zoom in if (Camera.main.orthographicSize < 3) { Camera.main.orthographicSize = 3; // Min size fix하기 } } if (wheelInput < 0) //wheel을 아래 방향으로 { Camera.main.orthographicSize = Camera.main.orthographicSize + 1; // Camera size 키우기 = zoom out if (Camera.main.orthographicSize > 9) { Camera.main.orthographicSize = 9; // Max size fix하기 } } } }