Lights wont turn back on

I am having an issue with lights not being able to be active after I have made them unactive. The way I am “turning on” and “turning off” the lights is using these lines of code:

gameObject.light.active = false; //Off
gameObject.light.active = true; //On

The off line works perfectly, however, when I try to turn them on it does not work. Does anyone know why this is happening?

Well I’m using C# and I got this working earlier:

public bool BeenTriggered;
public GameObject WarningLight;

...

if(BeenTriggered)
		{
			WarningLight.SetActive(true);
		}
		else
		{
			WarningLight.SetActive(false);
		}

the bool is public as it’s triggered from a different script. I just drag the light onto the public slot but however you access the gameObject should be fine.

Hope it helps