public void Reset() { geometryOverrideLayer = Consts.ConfigGeometryOverrideLayerDefault; geometryLayerID = Consts.ConfigGeometryLayerIDDefault; geometryTag = Consts.ConfigGeometryTagDefault; geometryRenderQueue = (int)Consts.ConfigGeometryRenderQueueDefault; beamShader1Pass = Shader.Find("Hidden/VolumetricLightBeam1Pass"); beamShader2Pass = Shader.Find("Hidden/VolumetricLightBeam2Pass"); sharedMeshSides = Consts.ConfigSharedMeshSides; sharedMeshSegments = Consts.ConfigSharedMeshSegments; globalNoiseScale = Consts.NoiseScaleDefault; globalNoiseVelocity = Consts.NoiseVelocityDefault; noise3DData = Resources.Load("Noise3D_64x64x64") as TextAsset; noise3DSize = Consts.ConfigNoise3DSizeDefault; dustParticlesPrefab = Resources.Load("DustParticles", typeof(ParticleSystem)) as ParticleSystem; renderPipeline = Consts.ConfigGeometryRenderPipelineDefault; renderingMode = Consts.ConfigGeometryRenderingModeDefault; #if UNITY_EDITOR GlobalMesh.Destroy(); VolumetricLightBeam._EditorSetAllMeshesDirty(); OnRenderPipelineChanged(renderPipeline); #endif }
void SetDirty(DirtyFlags flags) { if (m_IsUsedInstance) { if (flags.HasFlag(DirtyFlags.Target)) { EditorUtility.SetDirty(target); } if (flags.HasFlag(DirtyFlags.Shader)) { m_NeedToRefreshShader = true; } if (flags.HasFlag(DirtyFlags.Noise)) { m_NeedToReloadNoise = true; } if (flags.HasFlag(DirtyFlags.GlobalMesh)) { GlobalMesh.Destroy(); } if (flags.HasFlag(DirtyFlags.AllBeamGeom)) { VolumetricLightBeam._EditorSetAllBeamGeomDirty(); } if (flags.HasFlag(DirtyFlags.AllMeshes)) { VolumetricLightBeam._EditorSetAllMeshesDirty(); } } }
public void Reset() { geometryOverrideLayer = Consts.ConfigGeometryOverrideLayerDefault; geometryLayerID = Consts.ConfigGeometryLayerIDDefault; geometryTag = Consts.ConfigGeometryTagDefault; geometryRenderQueue = (int)Consts.ConfigGeometryRenderQueueDefault; sharedMeshSides = Consts.ConfigSharedMeshSides; sharedMeshSegments = Consts.ConfigSharedMeshSegments; globalNoiseScale = Consts.NoiseScaleDefault; globalNoiseVelocity = Consts.NoiseVelocityDefault; renderPipeline = Consts.ConfigGeometryRenderPipelineDefault; renderingMode = Consts.ConfigGeometryRenderingModeDefault; ditheringFactor = Consts.ConfigDitheringFactor; fadeOutCameraTag = Consts.ConfigFadeOutCameraTagDefault; featureEnabledColorGradient = Consts.ConfigFeatureEnabledColorGradientDefault; featureEnabledDepthBlend = Consts.ConfigFeatureEnabledDefault; featureEnabledNoise3D = Consts.ConfigFeatureEnabledDefault; featureEnabledDynamicOcclusion = Consts.ConfigFeatureEnabledDefault; featureEnabledMeshSkewing = Consts.ConfigFeatureEnabledDefault; featureEnabledShaderAccuracyHigh = Consts.ConfigFeatureEnabledDefault; ResetInternalData(); #if UNITY_EDITOR GlobalMesh.Destroy(); VolumetricLightBeam._EditorSetAllMeshesDirty(); #endif }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.LabelField(string.Format("Current Plugin Version: {0}", Version.Current), EditorStyles.miniBoldLabel); Header("Beam Geometry"); EditorGUI.BeginChangeCheck(); geometryLayerID.intValue = EditorGUILayout.LayerField(new GUIContent("Layer", "The layer the GameObjects holding the procedural cone meshes are created on"), geometryLayerID.intValue); geometryTag.stringValue = EditorGUILayout.TagField(new GUIContent("Tag", "The tag applied on the procedural geometry GameObjects"), geometryTag.stringValue); if (EditorGUI.EndChangeCheck()) { VolumetricLightBeam._EditorSetAllMeshesDirty(); } EditorGUILayout.PropertyField(beamShader, new GUIContent("Shader", "Main shader applied to the cone beam geometry")); Header("Global 3D Noise"); EditorGUILayout.PropertyField(globalNoiseScale, new GUIContent("Scale", "Global 3D Noise texture scaling: higher scale make the noise more visible, but potentially less realistic")); EditorGUILayout.PropertyField(globalNoiseVelocity, new GUIContent("Velocity", "Global World Space direction and speed of the noise scrolling, simulating the fog/smoke movement")); Header("3D Noise Texture Data"); bool reloadNoise = false; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(noise3DData, new GUIContent("Binary file", "Binary file holding the 3D Noise texture data (a 3D array). Must be exactly Size * Size * Size bytes long.")); int newSizeValue = EditorGUILayout.IntField(new GUIContent("Data dimension", "Size (of one dimension) of the 3D Noise data. Must be power of 2. So if the binary file holds a 32x32x32 texture, this value must be 32.") , noise3DSize.intValue); noise3DSize.intValue = Mathf.Max(2, Mathf.NextPowerOfTwo(newSizeValue)); if (EditorGUI.EndChangeCheck()) { reloadNoise = true; } if (Noise3D.isSupported && !Noise3D.isProperlyLoaded) { EditorGUILayout.HelpBox("Fail to load 3D noise texture", MessageType.Error); } Header("Volumetric Dust Particles"); EditorGUILayout.PropertyField(dustParticlesPrefab, new GUIContent("Prefab", "ParticleSystem prefab instantiated for the Volumetric Dust Particles feature (Unity 5.5 or above)")); EditorGUILayout.Space(); if (GUILayout.Button(new GUIContent("Default values", "Reset properties to their default values."), EditorStyles.miniButton)) { UnityEditor.Undo.RecordObject(target, "Reset Config Properties"); (target as Config).Reset(); } serializedObject.ApplyModifiedProperties(); if (reloadNoise) { Noise3D._EditorForceReloadData(); // Should be called AFTER ApplyModifiedProperties so the Config instance has the proper values when reloading data } }
public void Reset() { geometryLayerID = 1; beamShader = Shader.Find("VolumetricLightBeam/Beam"); globalNoiseScale = Consts.NoiseScaleDefault; globalNoiseVelocity = Consts.NoiseVelocityDefault; noise3DData = Resources.Load("Noise3D_64x64x64") as TextAsset; noise3DSize = 64; dustParticlesPrefab = Resources.Load("DustParticles", typeof(ParticleSystem)) as ParticleSystem; #if UNITY_EDITOR VolumetricLightBeam._EditorSetAllMeshesDirty(); #endif }
public void Reset() { ResetInternalData(); geometryOverrideLayer = Consts.ConfigGeometryOverrideLayerDefault; geometryLayerID = Consts.ConfigGeometryLayerIDDefault; geometryTag = Consts.ConfigGeometryTagDefault; geometryRenderQueue = (int)Consts.ConfigGeometryRenderQueueDefault; sharedMeshSides = Consts.ConfigSharedMeshSides; sharedMeshSegments = Consts.ConfigSharedMeshSegments; globalNoiseScale = Consts.NoiseScaleDefault; globalNoiseVelocity = Consts.NoiseVelocityDefault; renderPipeline = Consts.ConfigGeometryRenderPipelineDefault; renderingMode = Consts.ConfigGeometryRenderingModeDefault; #if UNITY_EDITOR GlobalMesh.Destroy(); VolumetricLightBeam._EditorSetAllMeshesDirty(); OnRenderPipelineChanged(renderPipeline); #endif }
public override void OnInspectorGUI() { base.OnInspectorGUI(); bool reloadNoise = false; if ((Object)Config.Instance != this.target) { EditorGUILayout.HelpBox(EditorStrings.ConfigMultipleAssets, MessageType.Error); EditorGUILayout.Separator(); ButtonOpenConfig(); } else { EditorGUI.BeginChangeCheck(); { if (HeaderFoldable("Beam Geometry")) { using (new EditorGUILayout.HorizontalScope()) { geometryOverrideLayer.boolValue = EditorGUILayout.Toggle(EditorStrings.ConfigGeometryOverrideLayer, geometryOverrideLayer.boolValue); using (new EditorGUI.DisabledGroupScope(!geometryOverrideLayer.boolValue)) { geometryLayerID.intValue = EditorGUILayout.LayerField(geometryLayerID.intValue); } } geometryTag.stringValue = EditorGUILayout.TagField(EditorStrings.ConfigGeometryTag, geometryTag.stringValue); } DrawLineSeparator(); if (HeaderFoldable("Rendering")) { RenderQueueGUIDraw(); if (BeamGeometry.isCustomRenderPipelineSupported) { EditorGUI.BeginChangeCheck(); { renderPipeline.CustomEnum <RenderPipeline>(EditorStrings.ConfigGeometryRenderPipeline, EditorStrings.ConfigGeometryRenderPipelineEnumDescriptions); } if (EditorGUI.EndChangeCheck()) { Config.OnRenderPipelineChanged((RenderPipeline)renderPipeline.enumValueIndex); VolumetricLightBeam._EditorSetAllBeamGeomDirty(); // need to fully reset the BeamGeom to update the shader ReimportShaders(); } } EditorGUI.BeginChangeCheck(); { EditorGUILayout.PropertyField(renderingMode, EditorStrings.ConfigGeometryRenderingMode); if (renderPipeline.enumValueIndex == (int)RenderPipeline.SRP_4_0_0_or_higher && renderingMode.enumValueIndex == (int)RenderingMode.MultiPass) { EditorGUILayout.HelpBox(EditorStrings.ConfigSrpAndMultiPassNoCompatible, MessageType.Error); } #pragma warning disable 0162 // warning CS0162: Unreachable code detected if (renderingMode.enumValueIndex == (int)RenderingMode.GPUInstancing && !GpuInstancing.isSupported) { EditorGUILayout.HelpBox(EditorStrings.ConfigGeometryGpuInstancingNotSupported, MessageType.Warning); } #pragma warning restore 0162 } if (EditorGUI.EndChangeCheck()) { VolumetricLightBeam._EditorSetAllBeamGeomDirty(); // need to fully reset the BeamGeom to update the shader GlobalMesh.Destroy(); ReimportShaders(); } } } if (EditorGUI.EndChangeCheck()) { VolumetricLightBeam._EditorSetAllMeshesDirty(); } DrawLineSeparator(); if (HeaderFoldable("Shared Mesh")) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(sharedMeshSides, EditorStrings.ConfigSharedMeshSides); EditorGUILayout.PropertyField(sharedMeshSegments, EditorStrings.ConfigSharedMeshSegments); if (EditorGUI.EndChangeCheck()) { GlobalMesh.Destroy(); VolumetricLightBeam._EditorSetAllMeshesDirty(); } var meshInfo = "These properties will change the mesh tessellation of each Volumetric Light Beam with 'Shared' MeshType.\nAdjust them carefully since they could impact performance."; meshInfo += string.Format("\nShared Mesh stats: {0} vertices, {1} triangles", MeshGenerator.GetSharedMeshVertexCount(), MeshGenerator.GetSharedMeshIndicesCount() / 3); EditorGUILayout.HelpBox(meshInfo, MessageType.Info); } DrawLineSeparator(); if (HeaderFoldable("Global 3D Noise")) { EditorGUILayout.PropertyField(globalNoiseScale, EditorStrings.ConfigGlobalNoiseScale); EditorGUILayout.PropertyField(globalNoiseVelocity, EditorStrings.ConfigGlobalNoiseVelocity); } DrawLineSeparator(); if (HeaderFoldable("Internal Data (do not change)")) { EditorGUILayout.PropertyField(beamShader1Pass, EditorStrings.ConfigBeamShader1Pass); EditorGUILayout.PropertyField(beamShader2Pass, EditorStrings.ConfigBeamShader2Pass); EditorGUILayout.PropertyField(dustParticlesPrefab, EditorStrings.ConfigDustParticlesPrefab); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(noise3DData, EditorStrings.ConfigNoise3DData); EditorGUILayout.PropertyField(noise3DSize, EditorStrings.ConfigNoise3DSize); if (EditorGUI.EndChangeCheck()) { reloadNoise = true; } if (Noise3D.isSupported && !Noise3D.isProperlyLoaded) { EditorGUILayout.HelpBox(EditorStrings.HelpNoiseLoadingFailed, MessageType.Error); } } DrawLineSeparator(); using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button(EditorStrings.ConfigOpenDocumentation, EditorStyles.miniButton)) { UnityEditor.Help.BrowseURL(Consts.HelpUrlConfig); } if (GUILayout.Button(EditorStrings.ConfigResetToDefaultButton, EditorStyles.miniButton)) { UnityEditor.Undo.RecordObject(target, "Reset Config Properties"); (target as Config).Reset(); } } } serializedObject.ApplyModifiedProperties(); if (reloadNoise) { Noise3D._EditorForceReloadData(); // Should be called AFTER ApplyModifiedProperties so the Config instance has the proper values when reloading data } }
public void OnActiveBuildTargetChanged(BuildTarget previousTarget, BuildTarget newTarget) { Config.Instance.RefreshShader(Config.RefreshShaderFlags.All); GlobalMesh.Destroy(); VolumetricLightBeam._EditorSetAllMeshesDirty(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); Debug.Assert(m_TargetConfig != null); m_NeedToReloadNoise = false; m_NeedToRefreshShader = false; m_IsUsedInstance = m_TargetConfig.IsCurrentlyUsedInstance(); // Config per plaftorm #if UNITY_2018_1_OR_NEWER { bool hasValidName = m_TargetConfig.HasValidAssetName(); bool isCurrentPlatformSuffix = m_TargetConfig.GetAssetSuffix() == PlatformHelper.GetCurrentPlatformSuffix(); var platformSuffix = m_TargetConfig.GetAssetSuffix(); string platformStr = "Default Config asset"; if (!string.IsNullOrEmpty(platformSuffix)) { platformStr = string.Format("Config asset for platform '{0}'", m_TargetConfig.GetAssetSuffix()); } if (!hasValidName) { platformStr += " (INVALID)"; } EditorGUILayout.LabelField(platformStr, EditorStyles.boldLabel); if (GUILayout.Button(EditorStrings.Beam.ButtonCreateOverridePerPlatform, EditorStyles.miniButton)) { var menu = new GenericMenu(); foreach (var platform in System.Enum.GetValues(typeof(RuntimePlatform))) { menu.AddItem(new GUIContent(platform.ToString()), false, OnAddConfigPerPlatform, platform); } menu.ShowAsContext(); } if (!hasValidName) { EditorGUILayout.Separator(); EditorGUILayout.HelpBox(EditorStrings.Config.InvalidPlatformOverride, MessageType.Error); ButtonOpenConfig(); } else if (!m_IsUsedInstance) { EditorGUILayout.Separator(); if (isCurrentPlatformSuffix) { EditorGUILayout.HelpBox(EditorStrings.Config.WrongAssetLocation, MessageType.Error); } else { EditorGUILayout.HelpBox(EditorStrings.Config.NotCurrentAssetInUse, MessageType.Warning); } ButtonOpenConfig(); } DrawLineSeparator(); } #endif { EditorGUI.BeginChangeCheck(); { if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderBeamGeometry)) { using (new EditorGUILayout.HorizontalScope()) { geometryOverrideLayer.boolValue = EditorGUILayout.Toggle(EditorStrings.Config.GeometryOverrideLayer, geometryOverrideLayer.boolValue); using (new EditorGUI.DisabledGroupScope(!geometryOverrideLayer.boolValue)) { geometryLayerID.intValue = EditorGUILayout.LayerField(geometryLayerID.intValue); } } geometryTag.stringValue = EditorGUILayout.TagField(EditorStrings.Config.GeometryTag, geometryTag.stringValue); } FoldableHeader.End(); if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderRendering)) { RenderQueueGUIDraw(); if (BeamGeometry.isCustomRenderPipelineSupported) { EditorGUI.BeginChangeCheck(); { renderPipeline.CustomEnum <RenderPipeline>(EditorStrings.Config.GeometryRenderPipeline, EditorStrings.Config.GeometryRenderPipelineEnumDescriptions); } if (EditorGUI.EndChangeCheck()) { SetDirty(DirtyFlags.AllBeamGeom | DirtyFlags.Shader); // need to fully reset the BeamGeom to update the shader } } if (m_TargetConfig.hasRenderPipelineMismatch) { EditorGUILayout.HelpBox(EditorStrings.Config.ErrorRenderPipelineMismatch, MessageType.Error); } EditorGUI.BeginChangeCheck(); { EditorGUILayout.PropertyField(renderingMode, EditorStrings.Config.GeometryRenderingMode); if (renderPipeline.enumValueIndex == (int)RenderPipeline.BuiltIn) { if (renderingMode.enumValueIndex == (int)RenderingMode.SRPBatcher) { EditorGUILayout.HelpBox(EditorStrings.Config.ErrorSrpBatcherOnlyCompatibleWithSrp, MessageType.Error); } } else { if (renderingMode.enumValueIndex == (int)RenderingMode.SRPBatcher && SRPHelper.renderPipelineType == SRPHelper.RenderPipeline.LWRP) { EditorGUILayout.HelpBox(EditorStrings.Config.ErrorSrpBatcherNotCompatibleWithLWRP, MessageType.Error); } if (renderingMode.enumValueIndex == (int)RenderingMode.MultiPass) { EditorGUILayout.HelpBox(EditorStrings.Config.ErrorSrpAndMultiPassNotCompatible, MessageType.Error); } } #pragma warning disable 0162 // warning CS0162: Unreachable code detected if (renderingMode.enumValueIndex == (int)RenderingMode.GPUInstancing && !BatchingHelper.isGpuInstancingSupported) { EditorGUILayout.HelpBox(EditorStrings.Config.ErrorGeometryGpuInstancingNotSupported, MessageType.Error); } #pragma warning restore 0162 } if (EditorGUI.EndChangeCheck()) { SetDirty(DirtyFlags.AllBeamGeom | DirtyFlags.GlobalMesh | DirtyFlags.Shader); // need to fully reset the BeamGeom to update the shader } if (m_TargetConfig.beamShader == null) { EditorGUILayout.HelpBox(EditorStrings.Config.GetErrorInvalidShader(), MessageType.Error); } if (ditheringFactor.FloatSlider(EditorStrings.Config.DitheringFactor, 0.0f, 1.0f)) { SetDirty(DirtyFlags.Shader); } } FoldableHeader.End(); } if (EditorGUI.EndChangeCheck()) { VolumetricLightBeam._EditorSetAllMeshesDirty(); } if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderSharedMesh)) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(sharedMeshSides, EditorStrings.Config.SharedMeshSides); EditorGUILayout.PropertyField(sharedMeshSegments, EditorStrings.Config.SharedMeshSegments); if (EditorGUI.EndChangeCheck()) { SetDirty(DirtyFlags.GlobalMesh | DirtyFlags.AllMeshes); } var meshInfo = "These properties will change the mesh tessellation of each Volumetric Light Beam with 'Shared' MeshType.\nAdjust them carefully since they could impact performance."; meshInfo += string.Format("\nShared Mesh stats: {0} vertices, {1} triangles", MeshGenerator.GetSharedMeshVertexCount(), MeshGenerator.GetSharedMeshIndicesCount() / 3); EditorGUILayout.HelpBox(meshInfo, MessageType.Info); } FoldableHeader.End(); if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderGlobal3DNoise)) { EditorGUILayout.PropertyField(globalNoiseScale, EditorStrings.Config.GlobalNoiseScale); EditorGUILayout.PropertyField(globalNoiseVelocity, EditorStrings.Config.GlobalNoiseVelocity); } FoldableHeader.End(); if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderFadeOutCamera)) { EditorGUI.BeginChangeCheck(); fadeOutCameraTag.stringValue = EditorGUILayout.TagField(EditorStrings.Config.FadeOutCameraTag, fadeOutCameraTag.stringValue); if (EditorGUI.EndChangeCheck() && Application.isPlaying) { m_TargetConfig.ForceUpdateFadeOutCamera(); } } FoldableHeader.End(); if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderFeaturesEnabled)) { EditorGUI.BeginChangeCheck(); { EditorGUILayout.PropertyField(featureEnabledColorGradient, EditorStrings.Config.FeatureEnabledColorGradient); EditorGUILayout.PropertyField(featureEnabledDepthBlend, EditorStrings.Config.FeatureEnabledDepthBlend); EditorGUILayout.PropertyField(featureEnabledNoise3D, EditorStrings.Config.FeatureEnabledNoise3D); EditorGUILayout.PropertyField(featureEnabledDynamicOcclusion, EditorStrings.Config.FeatureEnabledDynamicOcclusion); EditorGUILayout.PropertyField(featureEnabledMeshSkewing, EditorStrings.Config.FeatureEnabledMeshSkewing); EditorGUILayout.PropertyField(featureEnabledShaderAccuracyHigh, EditorStrings.Config.FeatureEnabledShaderAccuracyHigh); } if (EditorGUI.EndChangeCheck()) { SetDirty(DirtyFlags.Shader | DirtyFlags.AllBeamGeom); } } FoldableHeader.End(); if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderInternalData)) { EditorGUILayout.PropertyField(dustParticlesPrefab, EditorStrings.Config.DustParticlesPrefab); EditorGUILayout.PropertyField(ditheringNoiseTexture, EditorStrings.Config.DitheringNoiseTexture); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(noise3DData, EditorStrings.Config.Noise3DData); EditorGUILayout.PropertyField(noise3DSize, EditorStrings.Config.Noise3DSize); if (EditorGUI.EndChangeCheck()) { SetDirty(DirtyFlags.Noise); } if (Noise3D.isSupported && !Noise3D.isProperlyLoaded) { EditorGUILayout.HelpBox(EditorStrings.Common.HelpNoiseLoadingFailed, MessageType.Error); } } FoldableHeader.End(); if (GUILayout.Button(EditorStrings.Config.OpenDocumentation, EditorStyles.miniButton)) { UnityEditor.Help.BrowseURL(Consts.HelpUrlConfig); } using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button(EditorStrings.Config.ResetToDefaultButton, EditorStyles.miniButton)) { UnityEditor.Undo.RecordObject(target, "Reset Config Properties"); m_TargetConfig.Reset(); SetDirty(DirtyFlags.Target | DirtyFlags.Noise); } if (GUILayout.Button(EditorStrings.Config.ResetInternalDataButton, EditorStyles.miniButton)) { UnityEditor.Undo.RecordObject(target, "Reset Internal Data"); m_TargetConfig.ResetInternalData(); SetDirty(DirtyFlags.Target | DirtyFlags.Noise); } } } serializedObject.ApplyModifiedProperties(); if (m_NeedToRefreshShader) { m_TargetConfig.RefreshShader(Config.RefreshShaderFlags.All); // need to be done AFTER ApplyModifiedProperties } if (m_NeedToReloadNoise) { Noise3D._EditorForceReloadData(); // Should be called AFTER ApplyModifiedProperties so the Config instance has the proper values when reloading data } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); Header("Beam Geometry"); EditorGUI.BeginChangeCheck(); { using (new EditorGUILayout.HorizontalScope()) { geometryOverrideLayer.boolValue = EditorGUILayout.Toggle(EditorStrings.ConfigGeometryOverrideLayer, geometryOverrideLayer.boolValue); using (new EditorGUI.DisabledGroupScope(!geometryOverrideLayer.boolValue)) { geometryLayerID.intValue = EditorGUILayout.LayerField(geometryLayerID.intValue); } } geometryTag.stringValue = EditorGUILayout.TagField(EditorStrings.ConfigGeometryTag, geometryTag.stringValue); } Header("Rendering"); { RenderQueueGUIDraw(); EditorGUI.BeginChangeCheck(); { forceSinglePass.boolValue = EditorGUILayout.Toggle(EditorStrings.ConfigGeometryForceSinglePass, forceSinglePass.boolValue); } if (EditorGUI.EndChangeCheck()) { VolumetricLightBeam._EditorSetAllBeamGeomDirty(); // need to fully reset the BeamGeom to update the shader GlobalMesh.Destroy(); } } if (EditorGUI.EndChangeCheck()) { VolumetricLightBeam._EditorSetAllMeshesDirty(); } EditorGUILayout.PropertyField(beamShader1Pass, EditorStrings.ConfigBeamShader1Pass); EditorGUILayout.PropertyField(beamShader2Pass, EditorStrings.ConfigBeamShader2Pass); Header("Shared Mesh"); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(sharedMeshSides, EditorStrings.ConfigSharedMeshSides); EditorGUILayout.PropertyField(sharedMeshSegments, EditorStrings.ConfigSharedMeshSegments); if (EditorGUI.EndChangeCheck()) { GlobalMesh.Destroy(); VolumetricLightBeam._EditorSetAllMeshesDirty(); } var meshInfo = "These properties will change the mesh tessellation of each Volumetric Light Beam with 'Shared' MeshType.\nAdjust them carefully since they could impact performance."; meshInfo += string.Format("\nShared Mesh stats: {0} vertices, {1} triangles", MeshGenerator.GetSharedMeshVertexCount(), MeshGenerator.GetSharedMeshIndicesCount() / 3); EditorGUILayout.HelpBox(meshInfo, MessageType.Info); Header("Global 3D Noise"); EditorGUILayout.PropertyField(globalNoiseScale, EditorStrings.ConfigGlobalNoiseScale); EditorGUILayout.PropertyField(globalNoiseVelocity, EditorStrings.ConfigGlobalNoiseVelocity); Header("3D Noise Texture Data"); bool reloadNoise = false; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(noise3DData, EditorStrings.ConfigNoise3DData); EditorGUILayout.PropertyField(noise3DSize, EditorStrings.ConfigNoise3DSize); if (EditorGUI.EndChangeCheck()) { reloadNoise = true; } if (Noise3D.isSupported && !Noise3D.isProperlyLoaded) { EditorGUILayout.HelpBox(EditorStrings.HelpNoiseLoadingFailed, MessageType.Error); } Header("Volumetric Dust Particles"); EditorGUILayout.PropertyField(dustParticlesPrefab, EditorStrings.ConfigDustParticlesPrefab); EditorGUILayout.Separator(); EditorExtensions.HorizontalLineSeparator(); EditorGUILayout.Separator(); if (GUILayout.Button(EditorStrings.ConfigResetToDefaultButton, EditorStyles.miniButton)) { UnityEditor.Undo.RecordObject(target, "Reset Config Properties"); (target as Config).Reset(); } serializedObject.ApplyModifiedProperties(); if (reloadNoise) { Noise3D._EditorForceReloadData(); // Should be called AFTER ApplyModifiedProperties so the Config instance has the proper values when reloading data } }