【问题标题】:How to change the screen orientation when switching from one scene to another in UNITY?在UNITY中从一个场景切换到另一个场景时如何更改屏幕方向?
【发布时间】:2020-04-10 15:55:27
【问题描述】:

我的游戏中有 4 个场景,我需要将场景 1 和场景 3 设置为横向模式,将场景 2 和场景 4 设置为纵向模式,我该怎么做?请帮帮我……我找了很长时间,但找不到答案。

【问题讨论】:

  • 谢谢!我应该在哪里附加屏幕方向脚本?浏览了几个论坛,它建议我将它附加到场景的相机上。 @Marco Elizando
  • 任何地方都可以,但它可以在你用来加载场景的脚本中。

标签: c# unity3d vuforia game-development


【解决方案1】:

当你加载你的场景时,你可以使用

 Screen.orientation = ScreenOrientation.Portrait;

可用的方向位于ScreenOrientation

你可以阅读更多关于Screen.orientationhere的信息。

关于加载场景你可以使用SceneManager.LoadScene(scenename);,你可以阅读更多here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-27
    • 1970-01-01
    相关资源
    最近更新 更多