Try renaming the GameObject to something else, because "light" is already used. Every GameObject has a light variable by default (doesn't matter if it exists or not) and you're trying to access it.
Check this for more info:
http://docs.unity3d.com/ScriptReference/GameObject-light.html
**EDIT:**
Also if you want to disable/enable a GameObject, you have to use **obj.SetActive(true/false)**, because **obj.enabled** doesn't work here.
↧