I seem to have problems trying to get my light opened with a raycast.
First i have made a raycast attached it to my player controller.
Then i have made script for my lightswitch.
i attached an gameobject(light) to my lightswitch
the interaction says that my light is on or off but the light doesnt seem to be. here is my light script.
public Light myLight;
public bool open = false;
public void ChangeLightState()
{
open = !open;
}
void update()
{
if (open)
{
myLight.enabled = true;
}
else
{
myLight.enabled = false;
}
}
Let me know what i have done wrong thank you.