あなたの世界を作りなさい
ユーザーインターフェース
実行時の画面の向きを変更
2分
ワールド設定でデフォルト表示される画面の向きを設定してください。 向き 画面の向きを選択してください。 縦 横 以下は、実行時に画面の向きを変更するためのサンプルコードです。 サポートされている画面の向きは、縦と横の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を提供する場合、向きに対応する必要があります。