在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); } }