Tree Leaves are light up at night

Hey guys I am currently using a day/night cycle script that rotates a direction light 360 degrees in a certain amount of time. But when the light is at the position when it is supposed to be dark the leaves to the trees are still light up. I believe this may be a problem with the Shader but i am not sure. I am using the indie version so if that is the reason then…

This is either because:
A - The leaves are unlit which is quite likely, therefore you will need to darken these according to the time of day
B - The leaves are translucent, meaning the light shines through and illuminates the other side of the leaf, less likely in your case.

Solution:
Use javascript to set the shared material color tint according to the time of day:

renderer.material;// will edit just that objects material.
renderer.sharedMaterial;// will edit all of them

Does this help answer your question?

Well, I tried deleting the directional light in my game, and it made the trees dark as well, but when I made it look away from the trees, it maintained them lit! Then, I tried the equivalent of deleting the light, which is making the intensity to 0, and the trees turned dark. So I can surmise that you need to lower the intensity of your light.

Unfortunately, the directional light (at 1.3 intensity) is so strong that it shines onto my terrain at the completely opposite angle, but if I lower the intensity it isn’t strong enough (too far away). I found the answer. Changing the direction of the light doesn’t help. Change the intensity through code. Just use a true/false check to change magnitude of intensity over time. I’ve gotten this code to darken the light, I’m working on making the light lighten again.

var day=true;


/* Darken the light completely over a period of seconds 


function Awake()
{
	GetComponent(AudioSource); //background music
}

function Update () {
    if (day)
    {
    	Invoke("DaySwitch",5);
        light.color -= Color.white / 2.0 * Time.deltaTime;
    }
    if (day==false)
    {
        Invoke("DaySwitch",5);
        light.color+=Color.white / 2.0 * Time.deltaTime;
    }
}

function DaySwitch()
{
	if (day){
		day=false;
	}
	if (day==false){
		day=true;
	}
}