private void DrawBiomeSettings(bool helpEnabled) { m_biomePreset.m_orderNumber = m_editorUtils.IntField("OrderNumber", m_biomePreset.m_orderNumber, helpEnabled); Rect listRect = EditorGUILayout.GetControlRect(true, m_spawnerPresetList.GetHeight()); m_spawnerPresetList.DoList(listRect); m_editorUtils.InlineHelp("SpawnerAdded", helpEnabled); if (m_biomePreset.m_spawnerPresetList.Count == 0) { GUILayout.Space(EditorGUIUtility.singleLineHeight); EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoSpawnersYet"), MessageType.Warning); GUILayout.Space(10); if (m_editorUtils.Button("CreateFirstSpawner")) { GameObject spawnerObj = new GameObject("New Spawner"); Spawner spawner = spawnerObj.AddComponent <Spawner>(); spawner.m_createdfromBiomePreset = true; Selection.activeGameObject = spawnerObj; } GUILayout.Space(20); } else { GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (m_editorUtils.Button("CreateAdditionalSpawner", GUILayout.MaxWidth(200))) { GameObject spawnerObj = new GameObject("New Spawner"); Spawner spawner = spawnerObj.AddComponent <Spawner>(); spawner.m_createdfromBiomePreset = true; Selection.activeGameObject = spawnerObj; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUILayout.Space(EditorGUIUtility.singleLineHeight); m_biomePreset.GaiaSceneCullingProfile = (GaiaSceneCullingProfile)m_editorUtils.ObjectField("GaiaSceneCullingProfile", m_biomePreset.GaiaSceneCullingProfile, typeof(GaiaSceneCullingProfile), false, helpEnabled); #if UNITY_POST_PROCESSING_STACK_V2 GUILayout.Space(EditorGUIUtility.singleLineHeight); m_biomePreset.postProcessProfile = (PostProcessProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_biomePreset.postProcessProfile, typeof(PostProcessProfile), false, helpEnabled); #endif GUILayout.Space(EditorGUIUtility.singleLineHeight); serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(m_biomePreset); }
private void GlobalSettings(bool helpEnabled) { m_editorUtils.Heading("ScreenshotSetup"); EditorGUI.indentLevel++; m_profile.m_mainCamera = (Camera)m_editorUtils.ObjectField("MainCamera", m_profile.m_mainCamera, typeof(Camera), true, helpEnabled); m_profile.m_watermark = (Texture2D)m_editorUtils.ObjectField("Watermark", m_profile.m_watermark, typeof(Texture2D), true, helpEnabled, GUILayout.MaxHeight(16f)); m_profile.m_targetDirectory = m_editorUtils.TextField("TargetDirectory", m_profile.m_targetDirectory, helpEnabled); m_profile.m_screenShotKey = (KeyCode)m_editorUtils.EnumPopup("ScreenshotKey", m_profile.m_screenShotKey, helpEnabled); m_profile.m_imageFormat = (GaiaConstants.ImageFileType)m_editorUtils.EnumPopup("ImageFormat", m_profile.m_imageFormat, helpEnabled); EditorGUI.indentLevel--; EditorGUILayout.Space(); m_editorUtils.Heading("ScreenshotResolutionSetup"); EditorGUI.indentLevel++; m_profile.m_useScreenSize = m_editorUtils.Toggle("UseScreenSize", m_profile.m_useScreenSize, helpEnabled); if (!m_profile.m_useScreenSize) { GaiaConstants.ScreenshotResolution screenshotResolution = m_profile.m_screenshotResolution; screenshotResolution = (GaiaConstants.ScreenshotResolution)m_editorUtils.EnumPopup("ScreenshotResolution", screenshotResolution, helpEnabled); if (screenshotResolution != m_profile.m_screenshotResolution) { m_profile.m_screenshotResolution = screenshotResolution; m_profile.UpdateScreenshotResolution(m_profile.m_screenshotResolution); } if (screenshotResolution == GaiaConstants.ScreenshotResolution.Custom) { EditorGUI.indentLevel++; m_profile.m_targetWidth = m_editorUtils.IntField("TargetWidth", m_profile.m_targetWidth, helpEnabled); m_profile.m_targetHeight = m_editorUtils.IntField("TargetHeight", m_profile.m_targetHeight, helpEnabled); EditorGUI.indentLevel--; } } EditorGUI.indentLevel--; }
private void DetailTerrainDistance(bool helpEnabled) { EditorGUI.BeginChangeCheck(); m_editorUtils.Text("DetailInfo"); EditorGUILayout.Space(); //switch (m_profile.m_detailQuality) //{ // case GaiaConstants.TerrainDetailQuality.Ultra2: // EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "Ultra"); // break; // case GaiaConstants.TerrainDetailQuality.VeryHigh4: // EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "Very High"); // break; // case GaiaConstants.TerrainDetailQuality.High8: // EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "High"); // break; // case GaiaConstants.TerrainDetailQuality.Medium16: // EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "Medium"); // break; // case GaiaConstants.TerrainDetailQuality.Low32: // EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "Low"); // break; // case GaiaConstants.TerrainDetailQuality.VeryLow64: // EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "Very Low"); // break; //} //EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("DetailPatchResolutionHelp"), MessageType.Info); m_profile.m_detailDistance = m_editorUtils.IntField("DetailDistance", m_profile.m_detailDistance, helpEnabled); if (m_profile.m_detailDistance < 0) { m_profile.m_detailDistance = 0; } if (m_profile.m_detailDistance > 250) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("DetailDistanceHelp"), MessageType.Info); } m_profile.m_detailDensity = m_editorUtils.Slider("DetailDensity", m_profile.m_detailDensity, 0f, 1f, helpEnabled); if (m_profile.m_detailDistance > 250 && m_profile.m_detailDensity > 0.5f) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("DetailDensityHelp"), MessageType.Info); } if (m_editorUtils.Button("ApplyToAll")) { m_profile.ApplySettings(true); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(m_profile, "Made changes"); EditorUtility.SetDirty(m_profile); m_profile.ApplySettings(false); if (!Application.isPlaying) { EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } } }
private void DrawGeneralSettings(bool helpEnabled) { m_terrainLoaderManager.TerrainSceneStorage = (TerrainSceneStorage)m_editorUtils.ObjectField("TerrainSceneStorage", m_terrainLoaderManager.TerrainSceneStorage, typeof(TerrainSceneStorage), false, helpEnabled); bool oldLoadingEnabled = m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled; m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled = m_editorUtils.Toggle("TerrainLoadingEnabled", m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled, helpEnabled); if (!oldLoadingEnabled && m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled) { //User re-enabled the loaders m_terrainLoaderManager.UpdateTerrainLoadState(); } if (oldLoadingEnabled != m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled) { //Value was changed, dirty the object to make sure the value is being saved EditorUtility.SetDirty(m_terrainLoaderManager.TerrainSceneStorage); } bool originalGUIState = GUI.enabled; m_terrainLoaderManager.m_terrainLoadingTresholdMS = m_editorUtils.IntField("LoadingTimeTreshold", m_terrainLoaderManager.m_terrainLoadingTresholdMS, helpEnabled); m_terrainLoaderManager.m_trackLoadingProgressTimeOut = m_editorUtils.LongField("LoadingProgressTimeout", m_terrainLoaderManager.m_trackLoadingProgressTimeOut, helpEnabled); GUILayout.Space(10); m_editorUtils.Heading("SceneViewLoading"); m_terrainLoaderManager.CenterSceneViewLoadingOn = (CenterSceneViewLoadingOn)m_editorUtils.EnumPopup("CenterSceneViewLoadingOn", m_terrainLoaderManager.CenterSceneViewLoadingOn, helpEnabled); double loadingRange = m_editorUtils.DoubleField("SceneViewLoadingRange", m_terrainLoaderManager.GetLoadingRange(), helpEnabled); double impostorLoadingRange = m_terrainLoaderManager.GetImpostorLoadingRange(); if (GaiaUtils.HasImpostorTerrains()) { impostorLoadingRange = m_editorUtils.DoubleField("SceneViewImpostorLoadingRange", m_terrainLoaderManager.GetImpostorLoadingRange(), helpEnabled); } else { EditorGUILayout.BeginHorizontal(); m_editorUtils.Label("SceneViewImpostorLoadingRange"); //offer button to create impostors setup if (m_editorUtils.Button("OpenTerrainMeshExporterForImpostors", GUILayout.Width(EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 38))) { ExportTerrain exportTerrainWindow = EditorWindow.GetWindow <ExportTerrain>(); exportTerrainWindow.FindAndSetPreset("Create Impostors"); exportTerrainWindow.m_settings.m_customSettingsFoldedOut = false; } EditorGUILayout.EndHorizontal(); } if (loadingRange != m_terrainLoaderManager.GetLoadingRange() || impostorLoadingRange != m_terrainLoaderManager.GetImpostorLoadingRange()) { m_terrainLoaderManager.SetLoadingRange(loadingRange, impostorLoadingRange); } GUILayout.Space(10); m_editorUtils.Heading("CachingSettings"); m_editorUtils.InlineHelp("CachingSettings", helpEnabled); EditorGUI.BeginChangeCheck(); m_terrainLoaderManager.m_cacheInRuntime = m_editorUtils.Toggle("CacheInRuntime", m_terrainLoaderManager.m_cacheInRuntime, helpEnabled); m_terrainLoaderManager.m_cacheInEditor = m_editorUtils.Toggle("CacheInEditor", m_terrainLoaderManager.m_cacheInEditor, helpEnabled); string allocatedMegabytes = (Math.Round(Profiler.GetTotalAllocatedMemoryLong() / Math.Pow(1024, 2))).ToString(); string availableMegabytes = SystemInfo.systemMemorySize.ToString(); allocatedMegabytes = allocatedMegabytes.PadLeft(allocatedMegabytes.Length + (availableMegabytes.Length - allocatedMegabytes.Length) * 3, ' '); GUIStyle style = new GUIStyle(GUI.skin.label); if (m_terrainLoaderManager.m_cacheMemoryThreshold < Profiler.GetTotalAllocatedMemoryLong()) { style = redStyle; } else { style = greenStyle; } m_editorUtils.LabelField("MemoryAvailable", new GUIContent(availableMegabytes), helpEnabled); m_editorUtils.LabelField("MemoryAllocated", new GUIContent(allocatedMegabytes), style, helpEnabled); //GUI.color = originalGUIColor; if (m_terrainLoaderManager.m_cacheInRuntime || m_terrainLoaderManager.m_cacheInEditor) { m_terrainLoaderManager.m_cacheMemoryThresholdPreset = (CacheSizePreset)m_editorUtils.EnumPopup("CacheMemoryThreshold", m_terrainLoaderManager.m_cacheMemoryThresholdPreset, helpEnabled); if (m_terrainLoaderManager.m_cacheMemoryThresholdPreset == CacheSizePreset.Custom) { EditorGUI.indentLevel++; m_terrainLoaderManager.m_cacheMemoryThreshold = m_editorUtils.LongField("ThresholdInBytes", m_terrainLoaderManager.m_cacheMemoryThreshold, helpEnabled); EditorGUI.indentLevel--; } int cacheKeepAliveSeconds = (int)m_terrainLoaderManager.m_cacheKeepAliveTime / 1000; cacheKeepAliveSeconds = m_editorUtils.IntField("CacheKeepAliveSeconds", cacheKeepAliveSeconds, helpEnabled); m_terrainLoaderManager.m_cacheKeepAliveTime = cacheKeepAliveSeconds * 1000; } if (EditorGUI.EndChangeCheck()) { if (m_terrainLoaderManager.m_cacheMemoryThresholdPreset != CacheSizePreset.Custom) { m_terrainLoaderManager.m_cacheMemoryThreshold = (long)((int)m_terrainLoaderManager.m_cacheMemoryThresholdPreset * Math.Pow(1024, 3)); } m_terrainLoaderManager.UpdateCaching(); } GUILayout.Space(10); if (!GaiaUtils.HasColliderTerrains()) { GUI.enabled = false; } m_editorUtils.Heading("ColliderOnlyLoadingHeader"); //This flag is special in so far as that when the user switches it, we must first perform a scene unload while the old value is still active //then change the flag in the terrain scene storage and then do a refresh with the new setting applied. bool colliderLoadingEnabled = m_terrainLoaderManager.TerrainSceneStorage.m_colliderOnlyLoading; colliderLoadingEnabled = m_editorUtils.Toggle("ColliderOnlyLoadingEnabled", colliderLoadingEnabled, helpEnabled); if (colliderLoadingEnabled != m_terrainLoaderManager.TerrainSceneStorage.m_colliderOnlyLoading) { //User changed the flag, do an unload with the old setting m_terrainLoaderManager.UnloadAll(true); //then change the actual flag in storage m_terrainLoaderManager.TerrainSceneStorage.m_colliderOnlyLoading = colliderLoadingEnabled; //now do a refresh under the new setting m_terrainLoaderManager.RefreshSceneViewLoadingRange(); //Add the required scenes to build settings if (colliderLoadingEnabled) { GaiaSessionManager.AddOnlyColliderScenesToBuildSettings(TerrainLoaderManager.TerrainScenes); } else { GaiaSessionManager.AddTerrainScenesToBuildSettings(TerrainLoaderManager.TerrainScenes); } } GUI.enabled = originalGUIState; if (colliderLoadingEnabled) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("ColliderOnlyLoadingInfo"), MessageType.Info); m_editorUtils.Heading("DeactivateRuntimeHeader"); EditorGUI.indentLevel++; m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimePlayer = m_editorUtils.Toggle("DeactivateRuntimePlayer", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimePlayer, helpEnabled); m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeLighting = m_editorUtils.Toggle("DeactivateRuntimeLighting", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeLighting, helpEnabled); m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeAudio = m_editorUtils.Toggle("DeactivateRuntimeAudio", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeAudio, helpEnabled); m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWeather = m_editorUtils.Toggle("DeactivateRuntimeWeather", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWeather, helpEnabled); m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWater = m_editorUtils.Toggle("DeactivateRuntimeWater", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWater, helpEnabled); m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeScreenShotter = m_editorUtils.Toggle("DeactivateRuntimeScreenShotter", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeScreenShotter, helpEnabled); EditorGUI.indentLevel--; } else { //offer button to create collider setup if (m_editorUtils.Button("OpenTerrainMeshExporterForColliders")) { ExportTerrain exportTerrainWindow = EditorWindow.GetWindow <ExportTerrain>(); exportTerrainWindow.FindAndSetPreset("Collider"); exportTerrainWindow.m_settings.m_customSettingsFoldedOut = false; } } }
private void GlobalSettings(bool helpEnabled) { m_editorUtils.Heading("GlobalSettings"); m_profile.EnableUnderwaterEffects = m_editorUtils.Toggle("EnableUnderwaterEffects", m_profile.EnableUnderwaterEffects, helpEnabled); m_profile.m_seaLevel = m_editorUtils.FloatField("SeaLevel", m_profile.m_seaLevel, helpEnabled); m_profile.m_playerCamera = (Transform)m_editorUtils.ObjectField("PlayerCamera", m_profile.m_playerCamera, typeof(Transform), helpEnabled); m_profile.m_startingUnderwater = m_editorUtils.Toggle("StartingUnderwater", m_profile.m_startingUnderwater, helpEnabled); bool transitionEnabled = m_profile.m_enableTransitionFX; transitionEnabled = m_editorUtils.Toggle("EnableTransitionFX", transitionEnabled, helpEnabled); if (m_profile.m_enableTransitionFX != transitionEnabled) { m_profile.m_enableTransitionFX = transitionEnabled; m_profile.SetupTransitionVFX(m_profile.m_enableTransitionFX); } EditorGUILayout.Space(); m_editorUtils.Heading("CausticSettings"); m_profile.m_useCaustics = m_editorUtils.Toggle("UseCaustics", m_profile.m_useCaustics, helpEnabled); if (m_profile.m_useCaustics) { m_profile.m_mainLight = (Light)m_editorUtils.ObjectField("MainLight", m_profile.m_mainLight, typeof(Light), helpEnabled); m_profile.m_framesPerSecond = m_editorUtils.IntField("FramesPerSecond", m_profile.m_framesPerSecond, helpEnabled); m_profile.m_causticSize = m_editorUtils.Slider("CausticSize", m_profile.m_causticSize, 1f, 100f, helpEnabled); m_profile.m_editCausticTextures = m_editorUtils.Toggle("EditCausticTextures", m_profile.m_editCausticTextures, helpEnabled); if (m_profile.m_editCausticTextures) { for (int i = 0; i < m_profile.m_causticTextures.Count; i++) { EditorGUILayout.BeginHorizontal(); m_profile.m_causticTextures[i] = (Texture2D)EditorGUILayout.ObjectField(new GUIContent("[" + i + "]" + m_editorUtils.GetTextValue("CausticTexture"), m_editorUtils.GetTooltip("CausticTexture")), m_profile.m_causticTextures[i], typeof(Texture2D), false, GUILayout.MaxHeight(16f)); if (m_editorUtils.Button("Remove", GUILayout.MaxWidth(30f))) { m_profile.m_causticTextures.RemoveAt(i); } EditorGUILayout.EndHorizontal(); } if (m_editorUtils.Button("Add")) { m_profile.m_causticTextures.Add(null); } } } EditorGUILayout.Space(); m_editorUtils.Heading("FogSettings"); m_profile.m_supportFog = m_editorUtils.Toggle("SupportFog", m_profile.m_supportFog, helpEnabled); if (m_profile.m_supportFog) { m_profile.m_fogColorGradient = EditorGUILayout.GradientField(new GUIContent(m_editorUtils.GetTextValue("FogColor"), m_editorUtils.GetTooltip("FogColor")), m_profile.m_fogColorGradient); m_editorUtils.InlineHelp("FogColor", helpEnabled); if (m_renderPipeline != GaiaConstants.EnvironmentRenderer.HighDefinition) { if (RenderSettings.fogMode == FogMode.Linear) { m_profile.m_nearFogDistance = m_editorUtils.FloatField("FogStartDistance", m_profile.m_nearFogDistance, helpEnabled); m_profile.m_fogDistance = m_editorUtils.FloatField("FogEndDistance", m_profile.m_fogDistance, helpEnabled); } else { m_profile.m_fogDensity = m_editorUtils.Slider("FogDensity", m_profile.m_fogDensity, 0f, 1f, helpEnabled); } } else { m_profile.m_fogDistance = m_editorUtils.FloatField("FogEndDistance", m_profile.m_fogDistance, helpEnabled); } } EditorGUILayout.Space(); m_editorUtils.Heading("AudioSettings"); m_profile.m_playbackVolume = m_editorUtils.Slider("PlaybackVolume", m_profile.m_playbackVolume, 0f, 1f, helpEnabled); m_profile.m_submergeSoundFXDown = (AudioClip)m_editorUtils.ObjectField("SubmergeSoundFXDown", m_profile.m_submergeSoundFXDown, typeof(AudioClip), helpEnabled); m_profile.m_submergeSoundFXUp = (AudioClip)m_editorUtils.ObjectField("SubmergeSoundFXUp", m_profile.m_submergeSoundFXUp, typeof(AudioClip), helpEnabled); m_profile.m_underwaterSoundFX = (AudioClip)m_editorUtils.ObjectField("UnderwaterSoundFX", m_profile.m_underwaterSoundFX, typeof(AudioClip), helpEnabled); }