Hi, Using Unity 6 (preview):
In short: What’s the recommended way to let players disable 2D shadows (cast by ShadowCaster2Ds), OR increase the performance when using them?
And why can’t I disable/enable 2D shadows from the Universal Render Pipeline, or did I miss something?
In long: I like the 2D Shadows a lot, the improvements to the Shadow Caster 2Ds are really good (e.g. I can now add to Sprite Shape Controllers, and they will be used as the casting source).
I noticed they do take a hit on the performance, for larger maps.
What is the recommended way to let players disable the shadows OR increase the performance when using shadows?
Options available at the moment:
- Disabling Shadow Caster 2Ds entirely, see code below. Is that the correct way?
- In the Renderer 2D Data I can reduce the “Render Scale” for Light Render Textures to increase the performance when using shadows.
- If I select a Sprite Shape Controller I see at the bottom of the inspector, there is a “Shadow” quality dropdown. I can set it to Low, Medium or High Quality, but it only seems to increase the performance by a few FPS. And I can’t them by code(?)
- What else is there?
All suggestions appreciated,
public static void ToggleShadows(bool value)
{
var shadows = FindObjectsByType<ShadowCaster2D>(FindObjectsSortMode.None);
foreach (var shadow in shadows)
shadow.enabled = value;
}