How to know if something is in the shadow

Hi everyone,
For a game prototype i want to make something moving only on the shadow ( die when light for example)

i wanted to know if there is any possibility to know if an object is in the shadow or hit by light in the unity function?

there is also the way of making physics ray from light but if i had a lot of light
it’s going to be heavy.

if it’s possible i want to use the function of the shadow manager of unity

thanks.

Hi !

The answer found in here might just be what you need.

As gardian06 suggests, you can simply add a collider that covers the area covered by the light and detect collisions to know if the character is affected by the light or not.

You can use trigger colliders where the shadow is and perform your game functionality.
I would suggest avoiding heavy calculations as you know it just tips and tricks that works in game development.

Use the lookat with a raycast forward from the light to find if the ray will hit the player hope this helpz!!