using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class Death : MonoBehaviour { PlayerMovement playerMovement; [SerializeField] GameObject player; void Awake() { playerMovement = player.GetComponent(); } private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Player")) { playerMovement.isAlive = false; } } }