/// <summary> /// On Enable /// </summary> private void OnEnable() { #if UNITY_EDITOR m_gaiaSettings = GaiaUtils.GetGaiaSettings(); m_gaiaSceneInfo = GaiaSceneInfo.GetSceneInfo(); if (m_gaiaSettings != null) { m_currentRenderer = m_gaiaSettings.m_currentRenderer; } #if UNITY_POST_PROCESSING_STACK_V2 transitionPostFX = GameObject.Find("Underwater Transition PostFX").GetComponent <PostProcessVolume>(); underwaterPostFX = GameObject.Find("Underwater PostFX").GetComponent <PostProcessVolume>(); if (Application.isPlaying) { transitionPostFX = GameObject.Find("Underwater Transition PostFX").GetComponent <PostProcessVolume>(); if (transitionPostFX != null) { transitionPostFX.enabled = true; } underwaterPostFX = GameObject.Find("Underwater PostFX").GetComponent <PostProcessVolume>(); if (underwaterPostFX != null) { underwaterPostFX.enabled = true; } } else { transitionPostFX = GameObject.Find("Underwater Transition PostFX").GetComponent <PostProcessVolume>(); if (transitionPostFX != null) { transitionPostFX.enabled = false; } underwaterPostFX = GameObject.Find("Underwater PostFX").GetComponent <PostProcessVolume>(); if (underwaterPostFX != null) { underwaterPostFX.enabled = false; } } #endif #if UNITY_2019_1_OR_NEWER && HDPipeline if (m_currentRenderer == GaiaConstants.EnvironmentRenderer.HighDefinition2018x) { if (m_aboveWaterProfile == null) { m_aboveWaterProfile = AssetDatabase.LoadAssetAtPath <VolumeProfile>(GaiaPipelineUtils.GetAssetPath("Gaia HDRP Post Processing Profile")); } if (m_underwaterProfile == null) { m_underwaterProfile = AssetDatabase.LoadAssetAtPath <VolumeProfile>(GaiaPipelineUtils.GetAssetPath("Gaia HDRP Underwater Post Processing Profile")); } } #endif #endif }
/// <summary> /// On Enable /// </summary> private void OnEnable() { #if UNITY_EDITOR m_gaiaSettings = GaiaUtils.GetGaiaSettings(); m_gaiaSceneInfo = GaiaSceneInfo.GetSceneInfo(); if (m_gaiaSettings != null) { m_currentRenderer = m_gaiaSettings.m_currentRenderer; } #if UNITY_POST_PROCESSING_STACK_V2 transitionPostFX = GameObject.Find("Underwater Transition PostFX").GetComponent <PostProcessVolume>(); underwaterPostFX = GameObject.Find("Underwater PostFX").GetComponent <PostProcessVolume>(); if (Application.isPlaying) { transitionPostFX = GameObject.Find("Underwater Transition PostFX").GetComponent <PostProcessVolume>(); if (transitionPostFX != null) { transitionPostFX.enabled = true; } underwaterPostFX = GameObject.Find("Underwater PostFX").GetComponent <PostProcessVolume>(); if (underwaterPostFX != null) { underwaterPostFX.enabled = true; } } else { transitionPostFX = GameObject.Find("Underwater Transition PostFX").GetComponent <PostProcessVolume>(); if (transitionPostFX != null) { transitionPostFX.enabled = false; } underwaterPostFX = GameObject.Find("Underwater PostFX").GetComponent <PostProcessVolume>(); if (underwaterPostFX != null) { underwaterPostFX.enabled = false; } } #endif #if UNITY_2019_1_OR_NEWER && HDPipeline if (m_currentRenderer == GaiaConstants.EnvironmentRenderer.HighDefinition2018x) { if (m_aboveWaterProfile == null) { m_aboveWaterProfile = AssetDatabase.LoadAssetAtPath <VolumeProfile>(GaiaPipelineUtils.GetAssetPath("Gaia HDRP Post Processing Profile")); } if (m_underwaterProfile == null) { m_underwaterProfile = AssetDatabase.LoadAssetAtPath <VolumeProfile>(GaiaPipelineUtils.GetAssetPath("Gaia HDRP Underwater Post Processing Profile")); } } #endif #endif if (m_currentRenderer == GaiaConstants.EnvironmentRenderer.HighDefinition2018x) { GameObject volumeObject = GameObject.Find("High Definition Environment Volume"); if (volumeObject != null) { #if !UNITY_2019_1_OR_NEWER && HDPipeline if (volume == null) { volume = GameObject.Find("High Definition Environment Volume").GetComponent <Volume>(); if (volume != null) { VolumeProfile profile = volume.sharedProfile; if (profile != null) { VolumetricFog fog; if (profile.TryGet(out fog)) { storedFogColor = fog.albedo.value; storedFogDistance = fog.meanFreePath.value; } } } } #endif } else { Debug.LogWarning("Unabled to find a HDRP environment volume in the scene. Please insure one is set in this scene."); } } #if UNITY_2019_1_OR_NEWER && HDPipeline postVolume = GameObject.Find("Gaia HDRP Post Processing").GetComponent <Volume>(); #endif }