Trying to understand layerShadowCullDistances

Hello,

We want to cull shadows which are very far away from our camera.
We found Light.layerShadowCullDistances which going by the docs sounds perfect, however when we use it it behaves strange.

I’ve set up a basic script so that two layers have different shadow culling distances

        Light light = GetComponent<Light>();
        if(light)
		{
            float[] layers = new float[32];
            layers[0] = 5;
            layers[5] = 50;

            light.layerShadowCullDistances = layers;
        }

When using this script it would seem to work for close objects however if an object is far away from the camera it would still be rendered to the shadow map. Why is this? Is there not just a way to discard renderers from the shadow map which are too far away from the camera?

Kind regards,
Tom

I just want to add to this so hopefully it is clear.

There is 6 cubes in my scene

3 of those cubes are set to a layer which makes shadows render at 5 (Units?)
and the other 3 are at 50 (Units?)

As shown in the below image, if the object is bigger and sometimes just far out of view the shadow appears when it shouldn’t

Does anyone have any ideas why this happens?

Just want to bump this.

Cant tell if it is broken or we are not using it correctly

Bump. Hoping someone can help here.