Example #1
0
        private static void RemoveOverCloud()
        {
            GameObject overCloudPrefab = GameObject.Find("OverCloud");

            if (overCloudPrefab != null)
            {
                GameObject.DestroyImmediate(overCloudPrefab);
            }

            Camera mainCamera = GaiaUtils.GetCamera();

            if (mainCamera != null)
            {
                OverCloudCamera ocCamera = mainCamera.gameObject.GetComponent <OverCloudCamera>();
                if (ocCamera != null)
                {
                    GameObject.DestroyImmediate(ocCamera);
                }
            }

            if (GaiaUtils.CheckIfSceneProfileExists())
            {
                GaiaGlobal.Instance.SceneProfile.m_waterSystemMode = GaiaConstants.GlobalSystemMode.Gaia;
                GaiaSettings gaiaSettings = GaiaUtils.GetGaiaSettings();
                if (gaiaSettings != null)
                {
                    UnityPipelineProfile pipelineProfile = gaiaSettings.m_pipelineProfile;
                    if (pipelineProfile != null)
                    {
                        GaiaLighting.GetProfile(GaiaGlobal.Instance.SceneProfile, pipelineProfile, GaiaUtils.GetActivePipeline());
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Sets the pipeline asset to the procedural worlds asset if the profile is set yo change it
        /// </summary>
        /// <param name="profile"></param>
        public static void SetPipelineAsset(UnityPipelineProfile profile)
        {
            try
            {
                GaiaPackageVersion        unityVersion = GaiaManagerEditor.GetPackageVersion();
                UnityVersionPipelineAsset mapping      = profile.m_universalPipelineProfiles.Find(x => x.m_unityVersion == unityVersion);
                string pipelineAssetName = "";
                if (mapping != null)
                {
                    pipelineAssetName = mapping.m_pipelineAssetName;
                }
                else
                {
                    Debug.LogError("Could not determine the correct render pipeline settings asset for this unity version / rendering pipeline!");
                    return;
                }

                GraphicsSettings.renderPipelineAsset = AssetDatabase.LoadAssetAtPath <RenderPipelineAsset>(GaiaUtils.GetAssetPath(pipelineAssetName + GaiaConstants.gaiaFileFormatAsset));
                profile.m_pipelineSwitchUpdates      = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Example #3
0
        /// <summary>
        /// Sets the pipeline asset to the procedural worlds asset if the profile is set yo change it
        /// </summary>
        /// <param name="profile"></param>
        public static void SetPipelineAsset(UnityPipelineProfile profile)
        {
            if (GraphicsSettings.renderPipelineAsset == null)
            {
                GaiaPackageVersion unityVersion = GaiaPackageVersion.Unity2019_1;

                //Installation setup
                if (Application.unityVersion.Contains("2019.2"))
                {
                    unityVersion = GaiaPackageVersion.Unity2019_2;
                }
                else if (Application.unityVersion.Contains("2019.3"))
                {
                    unityVersion = GaiaPackageVersion.Unity2019_3;
                }

                UnityVersionPipelineAsset mapping = profile.m_lightweightPipelineProfiles.Find(x => x.m_unityVersion == unityVersion);
                string pipelineAssetName          = "";

                if (mapping != null)
                {
                    pipelineAssetName = mapping.m_pipelineAssetName;
                }
                else
                {
                    Debug.LogError("Could not determine the correct render pipeline settings asset for this unity version / rendering pipeline!");
                    return;
                }

                GraphicsSettings.renderPipelineAsset = AssetDatabase.LoadAssetAtPath <RenderPipelineAsset>(GetAssetPath(pipelineAssetName));
            }

            profile.m_pipelineSwitchUpdates = true;
        }
Example #4
0
        /// <summary>
        /// Configures scripting defines in the project
        /// </summary>
        public static void SetScriptingDefines(UnityPipelineProfile profile)
        {
            bool   isChanged         = false;
            string currBuildSettings = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);

            if (!currBuildSettings.Contains("LWPipeline"))
            {
                if (string.IsNullOrEmpty(currBuildSettings))
                {
                    currBuildSettings = "LWPipeline";
                }
                else
                {
                    currBuildSettings += ";LWPipeline";
                }
                isChanged = true;
            }

            if (currBuildSettings.Contains("HDPipeline"))
            {
                currBuildSettings = currBuildSettings.Replace("HDPipeline;", "");
                currBuildSettings = currBuildSettings.Replace("HDPipeline", "");
                isChanged         = true;
            }

            if (isChanged)
            {
                PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, currBuildSettings);
            }
        }
Example #5
0
        /// <summary>
        /// Removes HDRP Post processing
        /// </summary>
        /// <param name="pipelineProfile"></param>
        public static void RemovePostProcesing(UnityPipelineProfile pipelineProfile)
        {
            GameObject postObject = GameObject.Find(pipelineProfile.m_HDPostVolumeObjectName);

            if (postObject != null)
            {
                Object.DestroyImmediate(postObject);
            }
        }
Example #6
0
 /// <summary>
 /// Configures and setup the terrain
 /// </summary>
 /// <param name="profile"></param>
 public static void ConfigureTerrain(UnityPipelineProfile profile)
 {
     Terrain[] terrains = Terrain.activeTerrains;
     if (terrains != null)
     {
         foreach (Terrain terrain in terrains)
         {
             terrain.materialTemplate = profile.m_highDefinitionTerrainMaterial;
         }
     }
 }
Example #7
0
        /// <summary>
        /// Gets the pipeline profile
        /// </summary>
        /// <returns></returns>
        private static UnityPipelineProfile GetPipelineProfile()
        {
            UnityPipelineProfile profile = null;

            GaiaSettings settings = GaiaUtils.GetGaiaSettings();

            if (settings != null)
            {
                profile = settings.m_pipelineProfile;
            }

            return(profile);
        }
Example #8
0
        /// <summary>
        /// Finalizes the LWRP setup for your project
        /// </summary>
        /// <param name="profile"></param>
        private static void FinalizeLWRP(UnityPipelineProfile profile, GaiaSettings gaiaSettings)
        {
            MarkSceneDirty(true);
            EditorUtility.SetDirty(profile);
            profile.m_activePipelineInstalled = GaiaConstants.EnvironmentRenderer.Lightweight;

            GaiaManagerEditor manager = EditorWindow.GetWindow <Gaia.GaiaManagerEditor>(false, "Gaia Manager");

            if (manager != null)
            {
                manager.GaiaManagerStatusCheck(true);
            }
        }
Example #9
0
        /// <summary>
        /// Configures and setup the terrain
        /// </summary>
        /// <param name="profile"></param>
        private static void ConfigureTerrain(UnityPipelineProfile profile)
        {
            Terrain[] terrains = Terrain.activeTerrains;
            if (terrains != null)
            {
                foreach (Terrain terrain in terrains)
                {
#if !UNITY_2019_2_OR_NEWER
                    terrain.materialType = Terrain.MaterialType.Custom;
#endif
                    terrain.materialTemplate = profile.m_lightweightTerrainMaterial;
                }
            }
        }
Example #10
0
        //Private const strings

        public static void StartInstallation(string unityVersion, GaiaConstants.EnvironmentRenderer renderPipeline, ShaderMappingEntry[] materialLibrary, UnityPipelineProfile pipelineProfile, bool showDialog = true)
        {
            //Set settings
            m_materialLibrary     = materialLibrary;
            m_progressTimer       = m_timer;
            m_renderPipeline      = renderPipeline;
            m_unityVersion        = unityVersion;
            m_gaiaPipelineProfile = pipelineProfile;

            //Checks if the material library is empty
            if (m_materialLibrary.Length == 0)
            {
                Debug.LogError("Material Library is empty. Please check the pipeline profile that it contains the necessary information");
                FinishInstallingPackages();
                return;
            }

            //Popup dialog to proceed
            if (showDialog)
            {
                if (EditorUtility.DisplayDialog("Importing Shaders and Materials", "You are about to install new shaders and materials to targeted pipeline and unity version. Please make sure you're using the correct SRP before you proceed. Are you sure you want to proceed?", "Yes", "No"))
                {
                    EditorUtility.DisplayProgressBar("Preparing Installation", "Preparing shader directories...", 0.5f);

                    StartInstallingPackage();
                }
                else
                {
                    //Finish and exit
                    FinishInstallingPackages();
                }
            }
            else
            {
                EditorUtility.DisplayProgressBar("Preparing Installation", "Preparing shader directories...", 0.5f);

                StartInstallingPackage();
            }

            var manager = EditorWindow.GetWindow <GaiaManagerEditor>(false, "Gaia Manager");

            //Manager can be null if the dependency package installation is started upon opening the manager window.
            if (manager != null)
            {
                //Perform the status check in the manager again to update the UI to the (hopefully successful) installation
                manager.GaiaManagerStatusCheck(true);
            }
            m_installShaders = false;
        }
Example #11
0
        /// <summary>
        /// Configures water to LWRP
        /// </summary>
        /// <param name="profile"></param>
        private static void ConfigureWater(UnityPipelineProfile profile, GaiaSettings gaiaSettings)
        {
            if (gaiaSettings == null)
            {
                Debug.LogError("Gaia settings could not be found. Please make sure gaia settings is import into your project");
            }
            else
            {
                if (profile.m_underwaterHorizonMaterial != null)
                {
                    profile.m_underwaterHorizonMaterial.shader = Shader.Find(profile.m_lightweightHorizonObjectShader);
                }

                //Increasing Water mesh quality for LWRP
                gaiaSettings.m_gaiaWaterProfile.m_customMeshQuality = 8;
                if (GaiaGlobal.Instance != null)
                {
                    GaiaWater.UpdateWaterMeshQuality(GaiaGlobal.Instance.SceneProfile, GaiaGlobal.Instance.SceneProfile.m_waterPrefab);
                }

                GameObject waterObject = GameObject.Find(gaiaSettings.m_gaiaWaterProfile.m_waterPrefab.name);
                if (waterObject != null)
                {
                    Material waterMat = GaiaWater.GetGaiaOceanMaterial();
                    if (waterMat != null)
                    {
                        if (GaiaGlobal.Instance != null)
                        {
                            GaiaWater.GetProfile(0, waterMat, GaiaGlobal.Instance.SceneProfile, true, false);
                        }
                    }
                    else
                    {
                        Debug.Log("Material could not be found");
                    }
                }
            }

            PWS_WaterSystem reflection = Object.FindObjectOfType <PWS_WaterSystem>();

            if (reflection != null)
            {
                Object.DestroyImmediate(reflection);
            }
        }
Example #12
0
        /// <summary>
        /// Configures project for LWRP
        /// </summary>
        /// <param name="profile"></param>
        private static void ConfigureSceneToLWRP(UnityPipelineProfile profile)
        {
            GaiaSettings gaiaSettings = GaiaUtils.GetGaiaSettings();

            if (gaiaSettings.m_currentRenderer != GaiaConstants.EnvironmentRenderer.Lightweight)
            {
                Debug.LogError("Unable to configure your scene/project to LWRP as the current render inside of gaia does not equal Lightweight as it's active render pipeline. This process [GaiaLWRPPipelineUtils.ConfigureSceneToLWRP()] will now exit.");
                return;
            }

            if (profile.m_setLWPipelineProfile)
            {
                SetPipelineAsset(profile);
            }

            if (profile.m_LWAutoConfigureCamera)
            {
                ConfigureCamera();
            }

            if (profile.m_LWAutoConfigureLighting)
            {
                ConfigureLighting(gaiaSettings.m_gaiaLightingProfile);
            }

            if (profile.m_LWAutoConfigureWater)
            {
                ConfigureWater(profile, gaiaSettings);
            }

            if (profile.m_LWAutoConfigureProbes)
            {
                ConfigureReflectionProbes();
            }

            if (profile.m_LWAutoConfigureTerrain)
            {
                ConfigureTerrain(profile);
            }

            FinalizeLWRP(profile, gaiaSettings);
        }
Example #13
0
        /// <summary>
        /// Configures water to URP
        /// </summary>
        /// <param name="profile"></param>
        private static void ConfigureWater(UnityPipelineProfile profile, GaiaSettings gaiaSettings)
        {
            try
            {
                if (gaiaSettings == null)
                {
                    Debug.LogError("Gaia settings could not be found. Please make sure gaia settings is import into your project");
                }
                else
                {
                    if (profile.m_underwaterHorizonMaterial != null)
                    {
                        profile.m_underwaterHorizonMaterial.shader = Shader.Find(profile.m_universalHorizonObjectShader);
                    }

                    GameObject waterObject = GameObject.Find(gaiaSettings.m_gaiaWaterProfile.m_waterPrefab.name);
                    if (waterObject != null)
                    {
                        Material waterMat = GaiaWater.GetGaiaOceanMaterial();
                        if (waterMat != null)
                        {
                            if (GaiaGlobal.Instance != null)
                            {
                                GaiaWater.GetProfile(gaiaSettings.m_gaiaWaterProfile.m_selectedWaterProfileValuesIndex, waterMat, GaiaGlobal.Instance.SceneProfile, true, false);
                            }
                        }
                        else
                        {
                            Debug.Log("Material could not be found");
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Example #14
0
        /// <summary>
        /// Starts the LWRP Setup
        /// </summary>
        /// <param name="profile"></param>
        /// <returns></returns>
        public static IEnumerator StartURPSetup(UnityPipelineProfile profile)
        {
            if (profile == null)
            {
                Debug.LogError("UnityPipelineProfile is empty");
                yield return(null);
            }
            else
            {
                EditorUtility.DisplayProgressBar("Installing Universal", "Updating scripting defines", 0.5f);
                m_waitTimer1 -= Time.deltaTime;
                if (m_waitTimer1 < 0)
                {
                    SetScriptingDefines(profile);
                }
                else
                {
                    yield return(null);
                }

                while (EditorApplication.isCompiling)
                {
                    yield return(null);
                }

                EditorUtility.DisplayProgressBar("Installing Universal", "Updating scene to Universal", 0.75f);
                m_waitTimer2 -= Time.deltaTime;
                if (m_waitTimer2 < 0)
                {
                    ConfigureSceneToURP(profile);
                    profile.m_pipelineSwitchUpdates = false;
                    EditorUtility.ClearProgressBar();
                }
                else
                {
                    yield return(null);
                }
            }
        }
Example #15
0
        /// <summary>
        /// Finalizes the LWRP setup for your project
        /// </summary>
        /// <param name="profile"></param>
        private static void FinalizeURP(UnityPipelineProfile profile)
        {
            try
            {
                MarkSceneDirty(true);
                EditorUtility.SetDirty(profile);
                profile.m_activePipelineInstalled = GaiaConstants.EnvironmentRenderer.Universal;
                UpdateURPPipelineSettings(true, true);

                Debug.Log("Finalized URP");

                GaiaManagerEditor manager = EditorWindow.GetWindow <Gaia.GaiaManagerEditor>(false, "Gaia Manager");
                if (manager != null)
                {
                    manager.GaiaManagerStatusCheck(true);
                    manager.CheckForSetupIssues();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Example #16
0
        /// <summary>
        /// Cleans up LWRP components in the scene
        /// </summary>
        public static void CleanUpLWRP(UnityPipelineProfile profile, GaiaSettings gaiaSettings)
        {
#if LWPipeline
            LWRPAdditionalCameraData[] camerasData = Object.FindObjectsOfType <LWRPAdditionalCameraData>();
            if (camerasData != null)
            {
                foreach (LWRPAdditionalCameraData data in camerasData)
                {
                    Object.DestroyImmediate(data);
                }
            }

            LWRPAdditionalLightData[] lightsData = Object.FindObjectsOfType <LWRPAdditionalLightData>();
            if (lightsData != null)
            {
                foreach (LWRPAdditionalLightData data in lightsData)
                {
                    Object.DestroyImmediate(data);
                }
            }
#endif

            if (profile.m_underwaterHorizonMaterial != null)
            {
                profile.m_underwaterHorizonMaterial.shader = Shader.Find(profile.m_builtInHorizonObjectShader);
            }

            //reverting default water mesh quality
            gaiaSettings.m_gaiaWaterProfile.m_customMeshQuality = 2;
            if (GaiaGlobal.Instance != null)
            {
                GaiaWater.UpdateWaterMeshQuality(GaiaGlobal.Instance.SceneProfile, gaiaSettings.m_gaiaWaterProfile.m_waterPrefab);
            }

            GameObject waterPrefab = GameObject.Find(gaiaSettings.m_gaiaWaterProfile.m_waterPrefab.name);
            if (waterPrefab != null)
            {
                PWS_WaterSystem reflection = waterPrefab.GetComponent <PWS_WaterSystem>();
                if (reflection == null)
                {
                    reflection = waterPrefab.AddComponent <PWS_WaterSystem>();
                }
            }

            Terrain[] terrains = Terrain.activeTerrains;
            if (terrains != null)
            {
                foreach (Terrain terrain in terrains)
                {
#if !UNITY_2019_2_OR_NEWER
                    terrain.materialType = Terrain.MaterialType.BuiltInStandard;
#else
                    terrain.materialTemplate = profile.m_builtInTerrainMaterial;
#endif
                }
            }

            Terrain terrainDetail = Terrain.activeTerrain;
            if (terrainDetail != null)
            {
                if (terrainDetail.detailObjectDensity == 0f)
                {
                    if (EditorUtility.DisplayDialog("Detail Density Disabled!", "Details density is disabled on your terrain would you like to activate it?", "Yes", "No"))
                    {
                        terrainDetail.detailObjectDensity = 0.3f;
                    }
                }
            }

            GameObject LWRPReflections = GameObject.Find("LWRP Water Reflection Probe");
            if (LWRPReflections != null)
            {
                Object.DestroyImmediate(LWRPReflections);
            }

            GraphicsSettings.renderPipelineAsset = null;

            if (GaiaGlobal.Instance != null)
            {
                GaiaUtils.GetRuntimeSceneObject();
                GaiaLighting.GetProfile(GaiaGlobal.Instance.SceneProfile, gaiaSettings.m_pipelineProfile, GaiaConstants.EnvironmentRenderer.BuiltIn);
            }

            if (waterPrefab != null)
            {
                Material waterMat = GaiaWater.GetGaiaOceanMaterial();
                if (waterMat != null)
                {
                    if (GaiaGlobal.Instance != null)
                    {
                        GaiaWater.GetProfile(0, waterMat, GaiaGlobal.Instance.SceneProfile, true, false);
                    }
                }
                else
                {
                    Debug.Log("Material could not be found");
                }
            }

            MarkSceneDirty(false);
            EditorUtility.SetDirty(profile);
            profile.m_activePipelineInstalled = GaiaConstants.EnvironmentRenderer.BuiltIn;

            GaiaManagerEditor manager = EditorWindow.GetWindow <Gaia.GaiaManagerEditor>(false, "Gaia Manager");
            if (manager != null)
            {
                manager.GaiaManagerStatusCheck(true);
            }

            bool   isChanged         = false;
            string currBuildSettings = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
            if (currBuildSettings.Contains("LWPipeline"))
            {
                currBuildSettings = currBuildSettings.Replace("LWPipeline;", "");
                currBuildSettings = currBuildSettings.Replace("LWPipeline", "");
                isChanged         = true;
            }

            if (isChanged)
            {
                PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, currBuildSettings);
            }
        }
Example #17
0
        /// <summary>
        /// Cleans up LWRP components in the scene
        /// </summary>
        public static void CleanUpURP(UnityPipelineProfile profile, GaiaSettings gaiaSettings)
        {
            try
            {
#if UPPipeline
                UniversalAdditionalCameraData[] camerasData = GameObject.FindObjectsOfType <UniversalAdditionalCameraData>();
                GaiaURPRuntimeUtils.ClearUPCameraData(camerasData);

                UniversalAdditionalLightData[] lightsData = GameObject.FindObjectsOfType <UniversalAdditionalLightData>();
                GaiaURPRuntimeUtils.ClearUPLightData(lightsData);

                GameObject volumeObject = GameObject.Find("Global Post Processing");
                if (volumeObject != null)
                {
                    GameObject.DestroyImmediate(volumeObject);
                }

                Camera camera = GaiaUtils.GetCamera();
                if (camera != null)
                {
                    UniversalAdditionalCameraData cameraData = camera.GetComponent <UniversalAdditionalCameraData>();
                    if (cameraData == null)
                    {
                        cameraData = camera.gameObject.AddComponent <UniversalAdditionalCameraData>();
                    }

                    cameraData.renderPostProcessing = false;
                }
    #endif

                if (profile.m_underwaterHorizonMaterial != null)
                {
                    profile.m_underwaterHorizonMaterial.shader = Shader.Find(profile.m_builtInHorizonObjectShader);
                }

                GameObject waterPrefab = GameObject.Find(gaiaSettings.m_gaiaWaterProfile.m_waterPrefab.name);
                if (waterPrefab != null)
                {
                    //reverting default water mesh quality
                    gaiaSettings.m_gaiaWaterProfile.m_customMeshQuality = 2;
                    if (GaiaGlobal.Instance != null)
                    {
                        GaiaWater.UpdateWaterMeshQuality(GaiaGlobal.Instance.SceneProfile, gaiaSettings.m_gaiaWaterProfile.m_waterPrefab);
                    }

                    PWS_WaterSystem reflection = waterPrefab.GetComponent <PWS_WaterSystem>();
                    if (reflection == null)
                    {
                        reflection = waterPrefab.AddComponent <PWS_WaterSystem>();
                    }
                }

                Terrain[] terrains = Terrain.activeTerrains;
                if (terrains != null)
                {
                    foreach (Terrain terrain in terrains)
                    {
    #if !UNITY_2019_2_OR_NEWER
                        terrain.materialType = Terrain.MaterialType.BuiltInStandard;
    #else
                        terrain.materialTemplate = profile.m_builtInTerrainMaterial;
    #endif
                    }
                }

                Terrain terrainDetail = Terrain.activeTerrain;
                if (terrainDetail != null)
                {
                    if (terrainDetail.detailObjectDensity == 0f)
                    {
                        if (EditorUtility.DisplayDialog("Detail Density Disabled!", "Details density is disabled on your terrain would you like to activate it?", "Yes", "No"))
                        {
                            terrainDetail.detailObjectDensity = 0.3f;
                        }
                    }
                }

                GameObject LWRPReflections = GameObject.Find("URP Water Reflection Probe");
                if (LWRPReflections != null)
                {
                    Object.DestroyImmediate(LWRPReflections);
                }

                GraphicsSettings.renderPipelineAsset = null;
                QualitySettings.renderPipeline       = null;

                if (GaiaGlobal.Instance != null)
                {
                    //GaiaUtils.GetRuntimeSceneObject();
                    if (GaiaGlobal.Instance.SceneProfile != null && GaiaGlobal.Instance.SceneProfile.m_lightingProfiles.Count > 0)
                    {
                        GaiaLighting.GetProfile(GaiaGlobal.Instance.SceneProfile, gaiaSettings.m_pipelineProfile, GaiaConstants.EnvironmentRenderer.BuiltIn);
                    }
                }

                //Clean up the UPR post processing objects in the underwater effects
                //We need to look for transform instead of GameObjects, since the GOs can be disabled and won't be found then
                GameObject uwe = GameObject.Find(GaiaConstants.underwaterEffectsName);
                if (uwe != null)
                {
                    Transform utoTransform = uwe.transform.Find(GaiaConstants.underwaterTransitionObjectName);
                    if (utoTransform != null)
                    {
                        Object.DestroyImmediate(utoTransform.gameObject);
                    }

                    Transform uppTransform = uwe.transform.Find(GaiaConstants.underwaterPostProcessingName);
                    if (uppTransform != null)
                    {
                        Object.DestroyImmediate(uppTransform.gameObject);
                    }

                    Transform horizonTransform = uwe.transform.Find(GaiaConstants.underwaterHorizonName);
                    if (horizonTransform != null)
                    {
                        Object.DestroyImmediate(horizonTransform.gameObject);
                    }
                }


                if (waterPrefab != null)
                {
                    Material waterMat = GaiaWater.GetGaiaOceanMaterial();
                    if (waterMat != null)
                    {
                        if (GaiaGlobal.Instance != null)
                        {
                            GaiaWater.GetProfile(gaiaSettings.m_gaiaWaterProfile.m_selectedWaterProfileValuesIndex, waterMat, GaiaGlobal.Instance.SceneProfile, true, false);
                        }
                    }
                    else
                    {
                        Debug.Log("Material could not be found");
                    }
                }

                MarkSceneDirty(false);
                EditorUtility.SetDirty(profile);
                profile.m_activePipelineInstalled = GaiaConstants.EnvironmentRenderer.BuiltIn;

                GaiaManagerEditor manager = EditorWindow.GetWindow <Gaia.GaiaManagerEditor>(false, "Gaia Manager");
                if (manager != null)
                {
                    manager.GaiaManagerStatusCheck(true);
                }

                bool   isChanged         = false;
                string currBuildSettings = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
                if (currBuildSettings.Contains("UPPipeline"))
                {
                    currBuildSettings = currBuildSettings.Replace("UPPipeline;", "");
                    currBuildSettings = currBuildSettings.Replace("UPPipeline", "");
                    isChanged         = true;
                }

                if (isChanged)
                {
                    PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, currBuildSettings);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Example #18
0
        /// <summary>
        /// Configures project for LWRP
        /// </summary>
        /// <param name="profile"></param>
        private static void ConfigureSceneToURP(UnityPipelineProfile profile)
        {
            try
            {
                GaiaSettings gaiaSettings = GaiaUtils.GetGaiaSettings();
                if (gaiaSettings.m_currentRenderer != GaiaConstants.EnvironmentRenderer.Universal)
                {
                    Debug.LogError("Unable to configure your scene/project to URP as the current render inside of gaia does not equal Universal as it's active render pipeline. This process [GaiaLWRPPipelineUtils.ConfigureSceneToURP()] will now exit.");
                    return;
                }

                if (profile.m_setUPPipelineProfile)
                {
                    SetPipelineAsset(profile);
                }

                if (profile.m_UPAutoConfigureCamera)
                {
                    ConfigureCamera();
                }

                if (gaiaSettings.m_gaiaLightingProfile.m_enablePostProcessing)
                {
                    if (GaiaGlobal.Instance != null)
                    {
                        if (gaiaSettings.m_gaiaLightingProfile.m_selectedLightingProfileValuesIndex <= gaiaSettings.m_gaiaLightingProfile.m_lightingProfiles.Count - 1)
                        {
                            ApplyURPPostProcessing(gaiaSettings.m_gaiaLightingProfile.m_lightingProfiles[gaiaSettings.m_gaiaLightingProfile.m_selectedLightingProfileValuesIndex], GaiaGlobal.Instance.SceneProfile);
                        }
                    }
                }

                if (profile.m_UPAutoConfigureLighting)
                {
                    ConfigureLighting();
                }

                if (profile.m_UPAutoConfigureWater)
                {
                    ConfigureWater(profile, gaiaSettings);
                }

                if (profile.m_UPAutoConfigureProbes)
                {
                    GaiaURPRuntimeUtils.ConfigureReflectionProbes();
                }

                if (profile.m_UPAutoConfigureTerrain)
                {
                    GaiaURPRuntimeUtils.ConfigureTerrain(profile);
                }

                if (profile.m_UPAutoConfigureBiomePostFX)
                {
                    UpdateBiomePostFX();
                }

                FinalizeURP(profile);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }