using UnityEngine; public class Goal : MonoBehaviour { public Team team; void OnTriggerEnter2D(Collider2D collision) { if(collision.gameObject.CompareTag("Player")){ Debug.Log($"GOAL! {team.ToString()}", gameObject); Ball ball = collision.gameObject.GetComponent(); Debug.Log(ball.name); GameManager.instance.OnGoal(team); } } }