유니티 프로그램

[유니티] UNITY 안드로이드 앱을 만들고 나서 시작할 때 자꾸만 180도로 화면이 회전합니다.

비도르 2022. 7. 11. 12:59

[유니티] UNITY 안드로이드 앱을 만들고 나서 시작할 때 자꾸만 180도로 화면이 회전합니다.

 

안녕하세요. 오늘도 평화롭게 폭우가 내리는 2022년 여름입니다.
유니티로 안드로이드 어플리케이션을 만들고 나서 시작화면이 자꾸만 180도로 돌아가는 현상이 났습니다.
다른 분들도 저와 비슷한 경험을 하신 분들이 있을 것 같습니다.

Why??? 왜 이런 현상이 일어났는지 알아보겠습니다.

유니티 안드로이드 플랫폼에는 화면 회전을 설정하는 곳이 있습니다.
Player Settings/Player/Resolution and Presentation/Default Orientation
에 들어가서 설정을 수정하면 화면 회전을 변경할 수 있습니다.
아래 셋팅값을 보면 Default OrientationPortrait Upside Down 으로 설정되어서 시작할 때 화면이 180도 회전했었습니다.
그래서 셋팅값을 Portrait으로 변경 후 정상적으로 시작하는 것을 확인했네요 ^^;
그럼 오늘도 즐유~

Default Orientation

설명
1. Portrait : 세로 고정!
; [코드 작성 시] Screen.orientation = ScreenOrientation.Portrait;
1. Portrait Upside Down : 윗부분이 아래로 향하는 세로 고정!
; [코드 작성 시] Screen.orientation = ScreenOrientation.PortraitUpsideDown;
1. LandScapeLeft : 세로에서 반시계방향으로 90도인 가로 고정!
; [코드 작성 시] Screen.orientation = ScreenOrientation.LandscapeLeft;
1. LandScapeRight : 세로에서 시계방향으로 90도인 가로 고정!
; [코드 작성 시] Screen.orientation = ScreenOrientation.LandscapeRight;
1. Auto Rotation : 모바일 기기의 가로와 세로 위치에 따라서 회전이 변경!
; [코드 작성 시] Screen.orientation = ScreenOrientation.AutoRotation;
Screen.autorotateToPortrait = true;
Screen.autorotateToPortraitUpsideDown = true;
Screen.autorotateToLandscapeLeft = true;
Screen.autorotateToLandscapeRight = true;
//true: 회전가능,false: 회전안됨

순서
1. File/Build Settings 또는 단축키 Ctrl+Shift+B.

Build Settings 클릭

2. Android 로 플랫폼을 변경.

Player Setting 화면

3. Build And Run 버턴이 활성화 되면 플랫폼 변경이 완료됨.

Build And Run 버턴이 활성화

4. Player Settings 버턴을 클릭.

Player Settings 버턴

5. Player를 클릭.

Player를 클릭

6. Resolution and Presentation 클릭.

Resolution and Presentation 클릭

7. Default Orientation 클릭.

Default Orientation 클릭

8. 셋팅값 변경

셋팅값 변경

9. 따로 저장하지 않아도 창을 닫으면 설정이 저장됨.