简体   繁体   English

在UNITY中从一个场景切换到另一个场景时如何更改屏幕方向?

[英]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?我的游戏中有 4 个场景 我需要将场景 1 和场景 3 设置为横向模式,将场景 2 和场景 4 设置为纵向模式 我该怎么做? 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 .可用的方向在ScreenOrientation中。

And you can read more about Screen.orientation here .您可以在此处阅读有关Screen.orientation的更多信息。

About loading scenes you can use SceneManager.LoadScene(scenename);关于加载场景,您可以使用SceneManager.LoadScene(scenename); , you can read more here . ,你可以在这里阅读更多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过凝视一个物体从一个场景转到另一个场景? - how to go from one scene to another scene by gazing an object in unity? 如何将变量从一个场景中的一个对象传递到 Unity3D 中另一个场景中的另一个对象? - How to pass variables from one object in one scene to another object in another scene in Unity3D? 如何在Unity中更改场景之前完全等待方向更改 - How to wait for orientation change completely before changing scene in Unity 从监听器调用时如何更改Unity中的场景? - How to change scene in Unity when called from listener? 如何在一个场景中更改Unity中的MenuItem - How to Change MenuItems in Unity in One Scene 切换到另一个场景时不要卸载场景 - dont unload scene when switching to another scene Unity:从一个类似于 FixedUpdate 的协程切换到另一个 - Unity: Switching from one FixedUpdate-like coroutine to another one 将运行时实例化的对象从一个场景加载到Unity中的另一个场景 - Loading objects instantiated during runtime from one scene to another in Unity 从一个场景重定向到另一个Unity 3D脚本 - Redirect from one scene to another Unity 3D script 从另一个场景加载场景时加载的内容与在编辑器中首先选择该场景时加载不同(Unity,c#) - Scene loads differently when loaded from another scene than selecting that scene first, in the editor (Unity, c#)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM