gpt4 book ai didi

c# - Unity 5.3 如何加载当前电平?

转载 作者:可可西里 更新时间:2023-11-01 03:09:02 26 4
gpt4 key购买 nike

Unity 5.3之前,我可以做

Application.LoadLevel(Application.loadedLevel);

但现在 SceneManager 有点奇怪。我已经阅读了文档,但什么也没有。如何获取当前场景并加载它(Unity 5.3f4)?

谢谢!

最佳答案

使用新的 SceneManager并确保包含命名空间 UnityEngine.SceneManagement

using UnityEngine.SceneManagement;

public class Example
{
public void ReloadCurrentScene()
{
// get the current scene name
string sceneName = SceneManager.GetActiveScene().name;

// load the same scene
SceneManager.LoadScene(sceneName,LoadSceneMode.Single);
}
}

关于c# - Unity 5.3 如何加载当前电平?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34170650/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com