---
title: Changing Screen Orientation at runtime
slug: world-sdk-guide/changing-screen-orientation-at-runtime
docTags: 
createdAt: 2024-09-02T08:34:13.135Z
---

Please set the Screen Orientation to be displayed by default in World Settings.

![](https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-pa_-ov_CvYaVn_DNHQzGJ-20240904-102413.png)

- Orientation : Choose the orientation of the screen.
  - Vertical
  - Horizontal



The following is an example code to change the orientation of the screen at runtime.

Only two screen orientations are supported: Portrait and Landscape.

:::CodeblockTabs
ChangeOrientation

```typescript
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() {
  
        // When Button click
        this.orientationBtn.onClick.AddListener(() => {
             
            if(Screen.orientation == ScreenOrientation.Landscape)
            {
              	// Set Screen Orientation Portrait
                Screen.orientation = ScreenOrientation.Portrait;
            }
            else
            {
              	// Set Screen Orientation Landscape
                Screen.orientation = ScreenOrientation.Landscape;
            } 
        });
  
    }
}
```
:::

:::hint{type="success"}
👍 **Tip**

- Default UI (Home button, Chat button) and V-pad automatically support landscape-portrait switching when changing Screen Orientation.
- If you provide other custom UI in your content, you need to respond to the orientation.
:::

