I created a empty object and set it as trigger, then added this script:
using System.Collections;
using UnityEngine;
public class Light : MonoBehaviour
{
public Light light;
void OnTriggerEnter()
{
light.enabled = false;
}
void OnTriggerExit()
{
light.enabled = true;
}
}
But when try to drag and attach my directional light to it, it’s not happening. Why?