- Home /
Question by
richardzzzarnold · May 06, 2020 at 01:06 PM ·
cameracoroutinewhile-loop
Coroutine WHILE function not finding GO
For some reason I am getting errors when searching for a spawned object that holds the MainCamera. My script is the following:
void Start(){
StartCoroutine(FindCamera());}
IEnumerator FindCamera(){
while( activeCamera==null){
activeCamera= GameObject.FindWithTag("MainCamera").transform;
}
yield break;
}
I am getting a null reference exception on the FindWithTag line and am unsure why that is.
Comment