I recently started making a Pong game in Unity from this tutorial https://youtu.be/YHSanceczXY and one of the codes isnt working
enter code here
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Goal : MonoBehaviour
{
public bool isPlayer1Goal;
private void OnTriggerEnter2D(Collider collision)
{
if (collision.gameObject.CompareTag("Ball"))
{
if (!isPlayer1Goal)
{
Debug.Log("Player 2 Scored...");
GameObject.Find("GameManager").GetComponent<GameManager>().Player2Scored;
}
else
{
Debug.Log("Player 1 Scored...");
GameObject.Find("GameManager").GetComponent<GameManager>().Player1Scored;
}
}
}
}