【发布时间】:2013-11-01 23:25:32
【问题描述】:
我有 2 个场景,每个场景都有一个 ARcamera、图像目标和定向光。问题发生在我构建 APK 时。
它只显示场景 0,从不显示场景设置为 1。
我很n00b,我该怎么办?
【问题讨论】:
标签: android unity3d vuforia targets
我有 2 个场景,每个场景都有一个 ARcamera、图像目标和定向光。问题发生在我构建 APK 时。
它只显示场景 0,从不显示场景设置为 1。
我很n00b,我该怎么办?
【问题讨论】:
标签: android unity3d vuforia targets
我认为您的问题与构建 APK 无关。鉴于添加和选择了两个场景,它们应该构建得很好。但 Unity 不会一个接一个地“播放”它们。
场景 0 被设置为第一个场景。所以这将是它的开始。如果你想切换到不同的场景,你必须编写代码。
Unity 通过其SceneManager 功能提供了多种加载不同场景的方法。
SceneManager.LoadScene(...); //with the scene number or its nameSceneManager.LoadSceneAsync(...); //again, with the scene number or its name除了已经加载的场景之外,两者都允许单个场景加载或附加加载。
在 Unity 5.2 或更早版本中,这使用了现在被认为过时的应用程序方法:
Application.LoadLevel(...); //with the scene number, or its nameApplication.LoadLevelAsync(...); //again, with the scene number or its name或two additive scene loading options,这将使加载的对象保持不变。
所以你需要做的就是提供一些方法来调用加载不同的场景,你应该很高兴。
【讨论】:
GameObject.renderer.enabled = //true or false。 (假设图像目标具有渲染器组件)SetActive 禁用所有组件,这并不总是理想的。