简体   繁体   中英

How to change the screen orientation when switching from one scene to another in UNITY?

I have 4 scenes in my game I need to set scene 1 and scene 3 in landscape mode, scene 2 and scene 4 in portrait mode how can I do this? please help me out... I'm searching for a long time but couldn't find out the answer.

When you load your scene, you can use

 Screen.orientation = ScreenOrientation.Portrait;

The available orientations are inScreenOrientation .

And you can read more about Screen.orientation here .

About loading scenes you can use SceneManager.LoadScene(scenename); , you can read more here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM