Skip to content

Instantly share code, notes, and snippets.

@nickiaconis
Created November 10, 2019 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickiaconis/70f0ac5110e61d7215342145ce62c3c0 to your computer and use it in GitHub Desktop.
Save nickiaconis/70f0ac5110e61d7215342145ce62c3c0 to your computer and use it in GitHub Desktop.
idea for mod to change seasons in Cities: Skylines
// pseudo code for idea to change seasons in Cities: Skylines
onInterval() {
string loadedEnvironment = Singleton<LoadingManager>.instance.m_loadedEnvironment;
string simulationEnvironment = Singleton<SimulationManager>.instance.m_metaData.m_environment;
if (winterDateRange.contains(currentDate) && loadedEnvironment != WINTER) {
// Properties scene loading/unloading based on propertiesScene loading in LoadingManager#LoadLevelCoroutine
// not sure if unloading will break things
// also not sure if loading second properties scene will break things
// order may matter
// may also simply not be possible
AsyncOperation opLoad = SceneManager.LoadSceneAsync(WINTER + "Properties", LoadSceneMode.Additive);
AsyncOperation opUnload = SceneManager.UnloadSceneAsync(loadedEnvironment + "Properties");
while(!opLoad.isDone && !opUnload.isDone) {
yield return 0;
}
Singleton<LoadingManager>.instance.m_loadedEnvironment = WINTER;
// this may break things, but it'd be ideal to do for optimization
Resources.UnloadUnusedAssets();
} else if (!winterDateRange.contains(currentDate) && loadedEnvironment == WINTER && /* to prevent reloading winter forever */ simulationEnvironment != WINTER) {
// Properties scene loading/unloading based on propertiesScene loading in LoadingManager#LoadLevelCoroutine
// not sure if unloading will break things
// also not sure if loading second properties scene will break things
// order may matter
// may also simply not be possible
AsyncOperation opLoad = SceneManager.LoadSceneAsync(simulationEnvironment + "Properties", LoadSceneMode.Additive);
AsyncOperation opUnload = SceneManager.UnloadSceneAsync(loadedEnvironment + "Properties");
while(!opLoad.isDone && !opUnload.isDone) {
yield return 0;
}
Singleton<LoadingManager>.instance.m_loadedEnvironment = simulationEnvironment;
// this may break things, but it'd be ideal to do for optimization
Resources.UnloadUnusedAssets();
}
}
// or something like that anyway :P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment