How to get emissive materials to update and cast light during runtime

So this is kind of specific…

I have a script which when a bool is set to true within the script, it changes materials on an array of objects to an emissive material.

The problem is when I put the code in the update and wait for the bool to be checked, the materials DO change to the emissive material, but its light does not affect any surrounding objects.

If I run the code in the start function the lighting will affect surrounding objects, but not when I’m running it in the update.

This first image is what the emissive lighting should be doing

This second image is what is actually happening in game when the emissive materials have been changed.

What could be the issue?

public  class PowerGenerator : Repairable
{
    public Material _emissiveMaterial;
    public GameObject [] _lights = new GameObject []{};

    void Update()
    {
        PowerOn();
    }

    private void PowerOn()
    {
        if(_currentDurability == _maxDurability)
        {
            isRepaired = true;
        }

        if(isRepaired)
        {
            foreach(GameObject light in _lights)
            {
                light.GetComponent<Renderer>().material = _emissiveMaterial;
            }
        }
    }
}

I figured it out with the help of some mates.

The problem was the emission colour of the _emissiveMaterial was not updating on each of the game objects renderer components. So this needed to be done and then an update of the environment’s global illumination.

Here is the new code.

public  class PowerGenerator : Repairable
{
    public Material _emissiveMaterial;
    public GameObject [] _lights = new GameObject []{};
    private Color _emColour;
    private Renderer _rend;

    private void Start()
    {
        _emColour = _emissiveMaterial.GetColor("_EmissionColor");
    }

    public void Update()
    {
        PowerOn();
    }

    //When the power generator is repaired set the material of each light in the array to the _emissiveMaterial Material and render the new emission colour. 
    //Then update environment dynamic global illumination
    public void PowerOn()
    {
        if(_currentDurability == _maxDurability)
        {
            isRepaired = true;
        }

        if(isRepaired)
        {
            foreach(GameObject light in _lights)
            {
                light.GetComponent<Renderer>().sharedMaterial = _emissiveMaterial;
                _rend = light.GetComponent<Renderer>();
                DynamicGI.SetEmissive(_rend, _emColour);
            }

            DynamicGI.UpdateEnvironment();
        }
    }
}