using System; using UnityEngine; namespace UI { public class DeathScreen : MonoBehaviour { [SerializeField] private GameObject playerPrefab; [SerializeField] private GameObject fruitsPrefab; private float _timer; private void Update() { _timer += Time.deltaTime; if (_timer > 2f) { var spawnPos = GameObject.FindGameObjectWithTag("Respawn").transform.position; Instantiate(playerPrefab, spawnPos, Quaternion.identity); Destroy(gameObject); } } } }