public static void CreateSkyProfiles() { GaiaWaterProfile asset = ScriptableObject.CreateInstance <GaiaWaterProfile>(); AssetDatabase.CreateAsset(asset, "Assets/Gaia Water System Profile.asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; }
/// <summary> /// Show Select Profile Manager editor window /// </summary> public static void ShowProfileManager(GaiaLightingProfile lightingProfile, GaiaWaterProfile waterProfile, GaiaSettings gaiaSettings) { var manager = EditorWindow.GetWindow <SelectProfileWindowEditor>(false, "Lighting And Water Profile Selection"); if (manager != null) { manager.m_lightingProfile = lightingProfile; manager.m_waterProfile = waterProfile; manager.m_gaiaSettings = gaiaSettings; Vector2 initialSize = new Vector2(350f, 120f); manager.position = new Rect(new Vector2(Screen.currentResolution.width / 2f - initialSize.x / 2f, Screen.currentResolution.height / 2f - initialSize.y / 2f), initialSize); manager.Show(); } }
public void SaveToGaiaDefault(GaiaWaterProfileValues profileValues) { if (profileValues == null) { return; } GaiaWaterProfileValues newProfileValues = new GaiaWaterProfileValues(); GaiaUtils.CopyFields(profileValues, newProfileValues); newProfileValues.m_userCustomProfile = false; #if UNITY_POST_PROCESSING_STACK_V2 newProfileValues.PostProcessProfileBuiltIn = profileValues.PostProcessProfileBuiltIn; newProfileValues.m_postProcessingProfileGUIDBuiltIn = profileValues.m_postProcessingProfileGUIDBuiltIn; #endif #if UPPipeline newProfileValues.PostProcessProfileURP = profileValues.PostProcessProfileURP; newProfileValues.m_postProcessingProfileGUIDURP = profileValues.m_postProcessingProfileGUIDURP; #endif #if HDPipeline newProfileValues.PostProcessProfileHDRP = profileValues.PostProcessProfileHDRP; newProfileValues.m_postProcessingProfileGUIDHDRP = profileValues.m_postProcessingProfileGUIDHDRP; #endif GaiaSettings gaiaSettings = GaiaUtils.GetGaiaSettings(); if (gaiaSettings != null) { GaiaWaterProfile waterProfile = gaiaSettings.m_gaiaWaterProfile; if (waterProfile != null) { bool addProfile = true; int indexForReplacement = 0; for (int i = 0; i < waterProfile.m_waterProfiles.Count; i++) { if (waterProfile.m_waterProfiles[i].m_typeOfWater == newProfileValues.m_typeOfWater) { addProfile = false; indexForReplacement = i; } } if (addProfile) { SaveColorAndCubemapFields(newProfileValues, profileValues); waterProfile.m_waterProfiles.Add(newProfileValues); } else { #if UNITY_EDITOR if (EditorUtility.DisplayDialog("Profile Already Exists", "This profile " + newProfileValues.m_typeOfWater + " already exists the the default Gaia water profile. Do you want to replace this profile?", "Yes", "No")) { GaiaUtils.CopyFields(newProfileValues, waterProfile.m_waterProfiles[indexForReplacement]); SaveColorAndCubemapFields(waterProfile.m_waterProfiles[indexForReplacement], profileValues); #if UNITY_POST_PROCESSING_STACK_V2 waterProfile.m_waterProfiles[indexForReplacement].PostProcessProfileBuiltIn = profileValues.PostProcessProfileBuiltIn; waterProfile.m_waterProfiles[indexForReplacement].m_postProcessingProfileGUIDBuiltIn = profileValues.m_postProcessingProfileGUIDBuiltIn; #endif #if UPPipeline waterProfile.m_waterProfiles[indexForReplacement].PostProcessProfileURP = profileValues.PostProcessProfileURP; waterProfile.m_waterProfiles[indexForReplacement].m_postProcessingProfileGUIDURP = profileValues.m_postProcessingProfileGUIDURP; #endif #if HDPipeline waterProfile.m_waterProfiles[indexForReplacement].PostProcessProfileHDRP = profileValues.PostProcessProfileHDRP; waterProfile.m_waterProfiles[indexForReplacement].m_postProcessingProfileGUIDHDRP = profileValues.m_postProcessingProfileGUIDHDRP; #endif } #endif } #if UNITY_EDITOR EditorUtility.SetDirty(waterProfile); #endif Debug.Log("Profile successfully added to the Gaia Water Profile. Remember to save your project to save the changes"); } } }
/// <summary> /// Loads the profile type only /// </summary> /// <param name="mainProfile"></param> public void LoadProfileType(GaiaWaterProfile mainProfile) { mainProfile.m_selectedWaterProfileValuesIndex = m_waterProfileIndex; }