Skip to content

Commit 9f89323

Browse files
ApoorvaJEvergreen
authored andcommitted
Re-enable culling mask UI
This PR addresses [UUM-66079](https://jira.unity3d.com/browse/UUM-66079), and partially reverts some changes made in #43938, since @MINGWAI found a use-case where the Culling Mask is still useful in Forward+. This change 1. edits the tooltip of the culling mask. 2. makes the Culling Mask always editable, regardless of Deferred, Forward, Forward+ etc. 3. If the culling mask is set to a non-default value, adds this info box to alleviate the source of lots of user confusion. <img width="600" alt="image" src="https://media.github.cds.internal.unity3d.com/user/2726/files/04898627-06ec-4271-b411-10f1006707ee">
1 parent 3a48e76 commit 9f89323

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

Packages/com.unity.render-pipelines.universal/Editor/Lighting/UniversalRenderPipelineLightUI.Drawers.cs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -286,31 +286,10 @@ static void DrawRenderingContent(UniversalRenderPipelineSerializedLight serializ
286286
}
287287
}
288288

289-
var rendererList = UniversalRenderPipeline.asset.rendererDataList;
290-
bool hasNonForwardPlusRenderer = false;
291-
foreach (var r in rendererList)
292-
{
293-
if (r is UniversalRendererData ur)
294-
{
295-
if (ur.renderingMode != RenderingMode.ForwardPlus)
296-
{
297-
hasNonForwardPlusRenderer = true;
298-
break;
299-
}
300-
}
301-
else
302-
{
303-
hasNonForwardPlusRenderer = true;
304-
break;
305-
}
306-
}
307-
308-
GUI.enabled = hasNonForwardPlusRenderer;
309-
EditorGUILayout.PropertyField(serializedLight.settings.cullingMask, hasNonForwardPlusRenderer ? Styles.CullingMask : Styles.CullingMaskDisabled);
310-
GUI.enabled = true;
289+
EditorGUILayout.PropertyField(serializedLight.settings.cullingMask, Styles.CullingMask);
311290
if (serializedLight.settings.cullingMask.intValue != -1)
312291
{
313-
EditorGUILayout.HelpBox(Styles.CullingMaskWarning.text, MessageType.Warning);
292+
EditorGUILayout.HelpBox(Styles.CullingMaskWarning.text, MessageType.Info);
314293
}
315294
}
316295

Packages/com.unity.render-pipelines.universal/Editor/Lighting/UniversalRenderPipelineLightUI.Skin.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ private static class Styles
2121
public static readonly GUIContent BakingWarning = EditorGUIUtility.TrTextContent("Light mode is currently overridden to Realtime mode. Enable Baked Global Illumination to use Mixed or Baked light modes.");
2222
public static readonly GUIContent DisabledLightWarning = EditorGUIUtility.TrTextContent("Lighting has been disabled in at least one Scene view. Any changes applied to lights in the Scene will not be updated in these views until Lighting has been enabled again.");
2323
public static readonly GUIContent SunSourceWarning = EditorGUIUtility.TrTextContent("This light is set as the current Sun Source, which requires a directional light. Go to the Lighting Window's Environment settings to edit the Sun Source.");
24-
public static readonly GUIContent CullingMask = EditorGUIUtility.TrTextContent("Culling Mask", "Specifies which layers will be affected or excluded from the light's effect on objects in the scene. This only applies to objects rendered using the Forward rendering path, and transparent objects rendered using the Deferred rendering path.\n\nUse Rendering Layers instead, which is supported across all rendering paths.");
25-
public static readonly GUIContent CullingMaskDisabled = EditorGUIUtility.TrTextContent("Culling Mask", "Culling Mask is disabled. This is because all active renderers use the Forward+ rendering path, which doesn't support Culling Mask. Use Rendering Layers instead, which is supported across all rendering paths.");
26-
public static readonly GUIContent CullingMaskWarning = EditorGUIUtility.TrTextContent("Culling Mask only works with Forward rendering. Instead, use Rendering Layers on the Light, and Rendering Layer Mask on the Mesh Renderer, which will work across Deferred, Forward, and Forward+ rendering.");
24+
public static readonly GUIContent CullingMask = EditorGUIUtility.TrTextContent("Culling Mask", "Specifies which lights are culled per camera. To control exclude certain lights affecting certain objects, use Rendering Layers instead, which is supported across all rendering paths.");
25+
public static readonly GUIContent CullingMaskWarning = EditorGUIUtility.TrTextContent("Culling Mask should be used to control which lights are culled per camera. If you want to exclude certain lights from affecting certain objects, use Rendering Layers on the Light, and Rendering Layer Mask on the Mesh Renderer.");
2726

2827
public static readonly GUIContent ShadowRealtimeSettings = EditorGUIUtility.TrTextContent("Realtime Shadows", "Settings for realtime direct shadows.");
2928
public static readonly GUIContent ShadowStrength = EditorGUIUtility.TrTextContent("Strength", "Controls how dark the shadows cast by the light will be.");

0 commit comments

Comments
 (0)