Make object invisible when light is off

This is the setup: I’ve got a light and an object with illuminated texture. When the light is on the object needs to show, when the light is off the object needs to be invisible.

What’s the correct code to achieve this? I believe it is something like this:

if light_name.intensity = 0.5
{
illuminated_object.active = true;
}
if light_name.intensity <= 0.45
{
illuminated_object.active = false;
}

But I’m not a programmer so I don’t know the correct arguments/code.

try light.enabled

if (Gameobject.Find("Light Name").enabled=true)
illuminated_object.active = false;
else
illuminated_object.active = true;

The script could be something like this (attached to the illuminated object):

public var lightObj: GameObject; // drag the light object here

function Update(){
  // set variable lightOn to true when light intensity >= 0.5, false otherwise
  var lightOn: boolean = lightObj.light.intensity >= 0.5;
  renderer.enabled = lightOn; // enable this object
}

But be aware that this code doesn’t measure the light intensity: it just verifies the property intensity as set in the light. If you want to make some message or image appear when a flashlight is over it, there’s a different solution: take a look at my answer to the Revealing Light question.