using UnityEngine; //using UnityEngine.SceneManagement; using System.Collections; public class DodelijkGeraakt : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Player")) { Speler speler = other.gameObject.GetComponent(); Destroy (other.gameObject); StartCoroutine(LaadSpelOpnieuw()); } } IEnumerator LaadSpelOpnieuw() { yield return new WaitForSeconds (1); Application.LoadLevel (Application.loadedLevel); //SceneManager.LoadScene ("Scene 1"); } }