I have the following problem, I created a private void with the OnCollisionEnter and then an if statement to destroy the respective object, but nothing happens. Last time it worked, but now for some reason it doesn’t work anymore and I don’t get an error message either.
Code:
private void OnCollisionEnter(Collision collision)
{
Debug.Log(„Player collision with“ + collision.transform.name);
if (collision.transform.tag == „Goal“)
{
Destroy(collision.gameObject);
Debug.Log(„Player has reached the goal“);
}
}