void OnCollisionEnter(Collision Hit) { if (Hit.gameObject.tag == "Death" || Hit.gameObject.tag == "P1" || Hit.gameObject.tag == "P2") { Instantiate(Explosion, transform.position, transform.rotation); Cursor.visible = true; Cursor.lockState = CursorLockMode.None; if (Hit.gameObject.tag == "Death") { GameObject OtherPlayer; if (P1) { OtherPlayer = GameObject.Find("Car P2"); OtherPlayer.GetComponent <Rigidbody>().isKinematic = true; GameObject C = GameObject.Find("Main Camera " + OtherPlayer.tag); C.tag = "Win Camera"; foreach (Renderer MR in OtherPlayer.GetComponentsInChildren <MeshRenderer>()) { MR.enabled = false; } foreach (ParticleSystem PS in OtherPlayer.GetComponentsInChildren <ParticleSystem>()) { PS.enableEmission = false; } P2Wins.SetActive(true); } else { OtherPlayer = GameObject.Find("Car P1"); OtherPlayer.GetComponent <Rigidbody>().isKinematic = true; GameObject C = GameObject.Find("Main Camera " + OtherPlayer.tag); C.tag = "Win Camera"; foreach (Renderer MR in OtherPlayer.GetComponentsInChildren <MeshRenderer>()) { MR.enabled = false; } foreach (ParticleSystem PS in OtherPlayer.GetComponentsInChildren <ParticleSystem>()) { PS.enableEmission = false; } P1Wins.SetActive(true); } } else { Draw.SetActive(true); GameObject C = GameObject.Find("Main Camera P1"); C.tag = "Win Camera"; } EndScreen.SetActive(true); foreach (GameObject G in GameObject.FindGameObjectsWithTag("Death")) { if (G.name == "Death Trail(Clone)") { Destroy(G); } } RB.isKinematic = true; foreach (Renderer MR in GetComponentsInChildren <MeshRenderer>()) { MR.enabled = false; } foreach (ParticleSystem PS in GetComponentsInChildren <ParticleSystem>()) { PS.enableEmission = false; } } }