Dynamic lights with a raycast

Hey Guys,

I am new here(also new to unity)

Let me first explain what I am working on so you can understand the context of what I am trying to achieve.

What I use:
Unity Pro 3.4.2
City Engine
Some other external packages.

My game:
I am building a whole dynamic city(GTA style). The city will “live” with loads of people who go around their lives(For example: Eat, sleep, word, get fired, etc) This is still being worked on.

For the moment I am working on the GFX of the city itself. I already have the city itself(buildings, streets)a dynamic night/day cycle and a fully dynamic weather system(volumetric clouds) and dynamic shadows of the sun.

At night, I want the city to turn on its (dynamic) streetlights(MAANY LIGHTS), this takes down the performance of the game very very heavily. So what I would like to do is some kind of LOD system where lights turn on when the player gets within the xx radius of a light and turn off when they are outside a certain radius of the player.

Seeing how I want the lights to drop dynamic shadows on objects around the city I do not want it lightmapped.

I hope this will make performance much better.

Can anyone help me achieve this?

PS, Isn’t it supposed to be possible to get dynamic shadows with point and spot lights in the latest unity? Somehow they don’t.
PPS, I am fairly new with unity, so please consider that!

Solved!

By using a custom var to check for the distance between the main camera and the light(s) (linecast) and when the distance is shorter than xx meters, the command:

light.enabled = true;

else

light.enabled = false;