Skip to content

Instantly share code, notes, and snippets.

@matthijskooijman
Created March 6, 2016 15:00
Show Gist options
  • Save matthijskooijman/ae3491d2483abdbdbc95 to your computer and use it in GitHub Desktop.
Save matthijskooijman/ae3491d2483abdbdbc95 to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
public class SceneLoader {
static object sceneParam = null;
static Scene loadedScene;
public static T GetSceneParam<T>() where T : class {
return sceneParam as T;
}
public static Scene GetLoadedScene() {
return loadedScene;
}
public static IEnumerator LoadSceneAdditive(string name, object param) {
sceneParam = param;
yield return SceneManager.LoadSceneAsync(name, LoadSceneMode.Additive);
loadedScene = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
sceneParam = null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment