using UnityEngine; using System.Collections; public class respawners : MonoBehaviour { private bool player1; private bool player2; public GameObject respawnPoint; public GameObject deathTrigger; public bool objective = false; private checkpoint deathScript; // Use this for initialization void Start () { deathScript = deathTrigger.GetComponent (); } // Update is called once per frame void Update () { } void OnTriggerStay(Collider other) { if (other.name == "Player1") player1 = true; if (other.name == "Player2") player2 = true; if (player1 && player2) { if (objective) { Application.LoadLevel("CreditScreen"); } deathTrigger.SetActive(true); deathScript.respawnPoint = respawnPoint; gameObject.SetActive(false); } } }