// use case: round fail // for use with detecting collision of walls. void OnCollisionEnter(Collision col) { // destroy the plane anytime it collides with a wall if (col.gameObject.tag == "Floor" && !finished) { //StartCoroutine(WaitThenReset()); fpScript.DestroyPlaneAndReset(); } }
// need to use and IEnumerator here so that the // game waits before resetting IEnumerator WaitThenReset() { yield return(new WaitForSeconds(3)); fpScript.DestroyPlaneAndReset(); }