unity seems to crash as soon as i try to run the game with this code. it worked fine until the
while(true) line was added. any ideas why this might be?
void Start(){
y = 0;
StartCoroutine(checkTurrets());
}
IEnumerator checkTurrets(){
while (true) {
if (GameObject.Find ("right") != null) {
} else {
y++;
}
if (GameObject.Find ("left") != null) {
} else {
y++;
}
if (GameObject.Find ("bottom") != null) {
} else {
y++;
}
if (y == 3) {
y++;
SphereCollider sc = gameObject.AddComponent (typeof(SphereCollider)) as SphereCollider;
}
}
}
}