Skip to content

Instantly share code, notes, and snippets.

@Moe-Baker
Last active December 14, 2017 17:27
Show Gist options
  • Save Moe-Baker/b168a5060fd99244f671c8befac0398f to your computer and use it in GitHub Desktop.
Save Moe-Baker/b168a5060fd99244f671c8befac0398f to your computer and use it in GitHub Desktop.
//gets called on the local instance from the OnGameLoad, will only be called once obviously
void Configure()
{
Debug.Log("Manager Configured, Called Once The Game Loads, Right Before The Scene Load");
SceneManager.sceneLoaded += OnSceneChanged;
}
//listener to scene change event, calls the Init method
private void OnSceneChanged(Scene scene, LoadSceneMode loadMode)
{
Init();
}
//gets called on scene change, should act as a replacement for a monobehaviour's Awake, Start, .... methods
void Init()
{
Debug.Log("Manager Initilized, Called On Every Scene Load Including The Startup Scene");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment