Trees stay lit when it gets dark outside

Got this group project and none of them can find a fix for it so I’ve come here. We’ve got a terrain that we put a bunch of trees on with the tree tool. The game has a day and night cycle, but when it turns to night all the trees are unaffected by the darkness. They stay bright. I believe they are standard tree assets - ScotsPineTypeA and Willow with the Nature/Tree Soft Occlusion Bark and Nature/Tree Soft Occlusion Leaves shaders that came on them. The day/night cycle is controlled by two directional lights (Da Sun & Da Moon) that have this script on them:

using UnityEngine;
using System.Collections;

public class DayNight : MonoBehaviour {
    public GameObject pointToRotate;
    // Use this for initialization
    void Start ()
    {
   
    }
   
    // Update is called once per frame
    void Update ()
    {
        transform.RotateAround(pointToRotate.transform.position, Vector3.right, -0.7f * Time.deltaTime);
        transform.LookAt(pointToRotate.transform.position);
    }
}

I don’t know what other information might be useful. Anyone know how to get the trees to actually be affected by the darkness?

Rotate the camera a bit. It will force the tree billboards to update.

I’m not sure I know what you mean. Rotate the camera how?

  1. Initial state
    2607360--182765--1.jpg

  2. Lighting has changed, the billboards are still bright
    2607360--182766--2.jpg

  3. The camera has rotated 0.1°, all the billboards are now regenerated
    2607360--182767--3.jpg

PS
Terrain class also has Flush() method that applies all the changes to terrain and the trees, but it’s relatively slow.

1 Like