Is there a way to measure light exposure for a specific point in the game world that can be used in scripts?

I am trying to build a game that features monsters who scurry away from light and toward darkness. Is there any way I can use scripts to measure what the current light exposure at a given point is?

As far as I know you can’t count on lights/objects invisible to the camera to contribute to lighting/receive lighting because the 3D engine should optimize these out to save on rendering time. Even if you can somehow force the lighting calculations to happen it still would be a very inefficiency way to do what you want.

Best way would probably be to simply measure the distance to the nearest light and move the creature away from it.

You might actually be able to generate a mesh that takes the same shape as the light’s area of effect (more efficient if the light doesn’t move) and then if a given point is inside of that mesh calculate the distance and intensity to see if there’s too much light exposure.

I’d have to do some research on how to calculate the mesh shape. But from my understanding: Collision contact points give vertex positions and positions where edges clip through colliders. So that can give you a bit of a starting point on how to form the starting mesh.