private void Start() { envHider = new EnvironmentHider(); matSwapper = new MaterialSwapper(); matSwapper.GetMaterials(); CreateAllPlatforms(); // Retrieve saved path from player prefs if it exists if (PlayerPrefs.HasKey("CustomPlatformPath")) { string savedPath = PlayerPrefs.GetString("CustomPlatformPath"); // Check if this path was loaded and update our platform index for (int i = 0; i < bundlePaths.Count; i++) { if (savedPath == bundlePaths.ElementAt(i)) { platformIndex = i; } } } PlatformUI.OnLoad(); if (platforms.ElementAt(platformIndex) != null) { Log("Loading platforms."); //Finds and hides the environment after it loads. StartCoroutine(envHider.WaitForAndFindEnvironment(platforms.ElementAt(platformIndex))); } }
/// <summary> /// Handles active scene change. Hides Objects as required for the current platform /// </summary> /// <param name="arg0">Previous Active Scene</param> /// <param name="arg1">New Active Scene</param> private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1) { Log("Scene changed."); if (arg1.name == "Menu") { PlatformUI.OnLoad(); } if (platforms.ElementAt(platformIndex) != null) { Log("Loading Platforms"); //Finds and hides environment after it loads. StartCoroutine(envHider.WaitForAndFindEnvironment(platforms.ElementAt(platformIndex))); } }