CREATE YOUR WORLD
User Interface
런타임에서 Screen Orientation 변경하기
2분
기본적으로 표시될 화면 방향을 월드 설정에서 설정해 주세요 방향 화면의 방향을 선택하세요 세로 가로 다음은 런타임에 화면 방향을 변경하는 예제 코드입니다 지원되는 화면 방향은 두 가지입니다 세로 및 가로 changeorientation import { zepetoscriptbehaviour } from 'zepeto script'; import { button } from 'unityengine ui'; import { screen, screenorientation } from "unityengine"; export default class changeorientation extends zepetoscriptbehaviour { public orientationbtn button; start() { // 버튼 클릭 시 this orientationbtn onclick addlistener(() => { if(screen orientation == screenorientation landscape) { // 화면 방향을 세로로 설정 screen orientation = screenorientation portrait; } else { // 화면 방향을 가로로 설정 screen orientation = screenorientation landscape; } }); } } 👍 팁 기본 ui(홈 버튼, 채팅 버튼) 및 v pad는 화면 방향 변경 시 자동으로 가로 세로 전환을 지원합니다 콘텐츠에 다른 사용자 정의 ui를 제공하는 경우 방향에 응답해야 합니다