Question by
codeviant · Apr 30, 2020 at 07:39 AM ·
on and off
Can not attach to Directional Light
![alt text][1] [1]: /storage/temp/158133-1.png
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?
1.png
(231.6 kB)
Comment
Answer by codeviant · May 01, 2020 at 05:00 AM
A friend of me tried in his own pc but it's worked for him. It's not a problem about objects or script. Then what's the problem? Help please...