Unity3D/C#
2026. 11. 7.
유니티 화면 회전 고정 · 가로 세로 (Screen.orientation, autorotateTo)
세로로 하는 퍼즐 게임인데 폰을 눕히자 화면이 같이 돌아 UI 가 찌그러지거나, 가로 레이싱 게임이 침대에 누워 하면 세로로 바뀌어 버리는 일이 있습니다. 유니티에서는 Player Settings 의 Default Orientation 으로 앱이 켜질 때의 방향을 정하고, 실행 중에는 Screen.orientation 에 값을 넣어 세로나 가로로 고정합니다. 기기를 따라 돌게 두되 세로끼리만, 가로끼리만 돌게 하려면 Screen.autorotateTo 네 값을 함께 씁니다. Screen.orientation = ScreenOrientation.Portrait; // 세로 고정Screen.orientation = ScreenOrientation.LandscapeLeft; // 가로 고정 이..