When I start the simulation, the SpotLight is disabled. I want to enable\disable it by pressing on F.
But my code doesn’t work. I can’t see anything in the console.
GameObject spotLight;
bool isSpotLightActive = false;
void Start ()
{
spotLight = (GameObject)this.gameObject;
}
void Update ()
{
if (Input.GetKeyDown (KeyCode.F))
{
if(isSpotLightActive == false)
{
Debug.Log("acitvate"); // Don't see
spotLight.SetActive(true);
isSpotLightActive = true;
}
else if(isSpotLightActive == true)
{
Debug.Log("deacitvate"); // Don't see
spotLigh.SetActive(false);
isSpotLightActive = false;
}
}
}