using UnityEngine; using UnityEngine.SceneManagement; public class goal : MonoBehaviour { private void OnCollisionEnter2D(Collision2D other) { if (other.collider.tag == "Player") { Debug.Log("You win!!!"); GetComponent().Play(); SceneManager.LoadScene("winScreen"); } } }