using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class DieBlock : MonoBehaviour { public GameObject EndScreen; private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player" && !GameObject.Find("player").GetComponent().Finished) { int DieCount = PlayerPrefs.GetInt("CountDie"); //Instantiate(EndScreen); GameObject FD = collision.gameObject.transform.parent.gameObject; collision.gameObject.GetComponent().Lives = 0; Destroy(FD.transform.GetChild(1).gameObject); PlayerPrefs.SetInt("CountDie", DieCount +1); } } }