Created
March 6, 2016 15:00
-
-
Save matthijskooijman/ae3491d2483abdbdbc95 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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