IEnumerator Loadcubemap(FolderAssist.FileInfo file) { Console.WriteLine("Load cubemap: " + file.FileName); yield return(null); IsLoading = true; if (asyncLoad) { AssetBundleCreateRequest assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(file.FullPath); yield return(assetBundleCreateRequest); AssetBundle cubemapbundle = assetBundleCreateRequest.assetBundle; AssetBundleRequest bundleRequest1 = assetBundleCreateRequest.assetBundle.LoadAssetAsync <Material>("skybox-bg"); yield return(bundleRequest1); Skybox.Skyboxbg = bundleRequest1.asset as Material; AssetBundleRequest bundleRequest2 = assetBundleCreateRequest.assetBundle.LoadAssetAsync <Material>("skybox"); yield return(bundleRequest2); Skybox.Skybox = bundleRequest2.asset as Material; cubemapbundle.Unload(false); cubemapbundle = null; bundleRequest1 = null; bundleRequest2 = null; assetBundleCreateRequest = null; } else { AssetBundle cubemapbundle = AssetBundle.LoadFromFile(file.FullPath); Skybox.Skyboxbg = cubemapbundle.LoadAsset <Material>("skybox-bg"); Skybox.Skybox = cubemapbundle.LoadAsset <Material>("skybox"); cubemapbundle.Unload(false); cubemapbundle = null; } if (Skybox.Skyboxbg == null) { Skybox.Skyboxbg = Skybox.Skybox; } Skybox.ApplySkybox(); Skybox.ApplySkyboxParams(); EnvironmentUpdateFlag = true; Resources.UnloadUnusedAssets(); IsLoading = false; //ModPrefs.SetString("PHIBL", "LastLoadedCubeMap", file.FileName); yield break; }
internal void ResetIBL() { if (selectedCubemap > 0) { Skybox.ApplySkybox(); Skybox.ApplySkyboxParams(); } else if (selectedCubemap == 0) { ProceduralSkybox.ApplySkybox(); ProceduralSkybox.ApplySkyboxParams(); } probeComponent.enabled = (selectedScene < 0); EnvironmentUpdateFlag = true; LightsInit(); }