GameDev/[Unity]

[유니티]안드로이드 화면 고정, 회전(가로/세로) 설정 방법

Bit by Bit 2024. 2. 15. 16:57
728x90

유니티 안드로이드 화면 고정, 회전 설정 방법

 

1. [Edit - Project Settings - Player] 에 들어가셔서 Resolution and Presentation을 선택합니다.

2. Orientation 안에 Default Orientation 설정을 사용해 화면 고정 및 회전시킬 수 있습니다.

  • Portrait - 세로 고정(홈버튼 아래쪽 위치)
  • Portrait Upsode Down - 세로 고정(홈버튼 위쪽 위치)
  • LandscapeLeft - 가로 고정(홈버튼 오른쪽 위치)
  • LandscapeRight - 가로 고정(홈버튼 왼쪽 위치)
  • AutoRotation - 휴대폰 회전에 따라 화면 변경 (세부 옵션에 해당하는 버튼 해제시 그 방향으로 핸드폰을 회전시켜도 화면은 그대로 유지된다.)

Script에서 변경 방법

  • Screen.orientation = ScreenOrientation.Portrait;  //세로 고정(홈버튼 아래쪽 위치)
  • Screen.orientation = ScreenOrientation.PortraitUpsideDown;  // 세로 고정(홈버튼 위쪽 위치)
  • Screen.orientation = ScreenOrientation.LandscapeLeft;  // 가로 고정(홈버튼 오른쪽 위치)
  • Screen.orientation = ScreenOrientation.LandscapeRight;  // 가로 고정(홈버튼 왼쪽 위치)
  • Screen.orientation = ScreenOrientation.AutoRotation;  //휴대폰 회전에 따라 화면 변경
    • Screen.autorotateToPortrait = true;(또는 false)
    • Screen.autorotateToPortraitUpsideDown = true;(또는 false)
    • Screen.autorotateToLandscapeLeft = true;(또는 false)
    • Screen.autorotateToLandscapeRight = true;(또는 false)
728x90