I’m trying to get a specific light by it’s tag.
private Light theSun;
void Awake()
{
theSun = GameObject.FindGameObjectWithTag("Sun") as Light;
}
i’m getting the error “‘UnityEngine.GameObject’ to ‘UnityEngine.Light’ via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion”. What is the proper way to cast the GameObject to a light? Is there a better way to do this all together? Thanks.