AI detect player in shadows problem

Hey! I have been working on this AI for a few weeks. Its sortof high quality, and Im proud of it, but I have a few minor issues. The major minor issue is this:

1/3rd of the system that decide wheter or not the AI can see the player is based on a renderTexture. The renderTexture renders the AIs view every so often, if the AI/player has gone trough the other 2/3rds of the detection system. My problem isn’t with the system itself, it works good. My problem is with shadows and layers in unity 5!

The renderTexture must only render the player, so I set the AIs culling mask to layers “Player” and “Shadow”. Naturally, the player is on the player layer. But on the shadow layer I had to copy the entire map, put it on its own layer. Change its “cast shadows” option to “shadows only”. And finally the shadow layer is only rendered by the AIs renderTexture camera.

So while this works, its buggy when there is only 1 light lighting up the player, and the player is standing between the light and the AI. Because the light hits the player on the back, instad of So our logic would say “Oh, there is a light there, the sorroundings are bright and I am blocking the light. I am obviously visible!” but the AI goes “Nope, that cannot be the player, its just a random dark blob! Better keep moving!”

There must be a simple solution to this right? Isn’t bounce lighting a big thing in unity 5?

Bump. This didn’t work as the AI often sees both lit up and dark areas at the same time. Need help!