static bool CreateLightValidation() { LightweightRenderPipeline pipeline = UnityEngine.Rendering.RenderPipelineManager.currentPipeline as LightweightRenderPipeline; if (pipeline != null) { LightweightRenderPipelineAsset asset = LightweightRenderPipeline.asset; _2DRendererData assetData = asset.scriptableRendererData as _2DRendererData; if (assetData != null) { return(true); } } return(false); }
public override void OnInspectorGUI() { LightweightRenderPipeline pipeline = UnityEngine.Rendering.RenderPipelineManager.currentPipeline as LightweightRenderPipeline; if (pipeline == null) { EditorGUILayout.HelpBox(Styles.renderPipelineUnassignedWarning); return; } LightweightRenderPipelineAsset asset = LightweightRenderPipeline.asset; _2DRendererData assetData = asset.scriptableRendererData as _2DRendererData; if (assetData == null) { EditorGUILayout.HelpBox(Styles.asset2DUnassignedWarning); return; } EditorGUILayout.Space(); serializedObject.Update(); EditorGUILayout.PropertyField(m_LightType, Styles.generalLightType); switch (m_LightType.intValue) { case (int)Light2D.LightType.Point: { OnPointLight(serializedObject); } break; case (int)Light2D.LightType.Parametric: case (int)Light2D.LightType.Freeform: case (int)Light2D.LightType.Sprite: { OnShapeLight((Light2D.LightType)m_LightType.intValue, serializedObject); } break; } EditorGUI.BeginChangeCheck(); EditorGUILayout.IntPopup(m_LightOperation, m_LightOperationNames, m_LightOperationIndices, Styles.generalLightOperation); EditorGUILayout.PropertyField(m_LightColor, Styles.generalLightColor); EditorGUILayout.PropertyField(m_LightIntensity, Styles.generalLightIntensity); m_LightIntensity.floatValue = Mathf.Max(m_LightIntensity.floatValue, 0); bool updateGlobalLights = EditorGUI.EndChangeCheck(); if (m_LightType.intValue != (int)Light2D.LightType.Global) { EditorGUILayout.Slider(m_VolumetricAlpha, 0, 1, Styles.generalVolumeOpacity); } OnTargetSortingLayers(); if (updateGlobalLights) { RemoveSelectedGlobalLights(targets); } serializedObject.ApplyModifiedProperties(); if (updateGlobalLights) { AddSelectedGlobalLights(targets); } }