public static void UnloadScene(string sname) { if (string.IsNullOrEmpty(sname)) { return; } ABLoader.UnloadScene(ScenePathPrefix + sname); // 和上一场景一致 if (lastSceneName == sname) { lastSceneName = null; } }
public static void LoadScene(string sname) { if (string.IsNullOrEmpty(sname)) { return; } // 加载新场景 bool r = ABLoader.LoadScene(ScenePathPrefix + sname, sname); // 卸载上一个场景 if (!string.IsNullOrEmpty(lastSceneName) && sname != lastSceneName) { ABLoader.UnloadScene(ScenePathPrefix + lastSceneName); lastSceneName = null; } // if (r) { lastSceneName = sname; } }