hi guys i want my player to be destroyed when i hit the camera … i used the following scrpits but it did not work
first on the camera I put a collider
and I entered this code
private void OnTriggerEnter2D (Collider2D other)
{
if (other.gameObject.CompareTag ("Player"))
{
Destroy (player);
}
}
but it did not work
so I inserted it into the player
private void OnTriggerEnter2D (Collider2D other)
{
if (other.gameObject.CompareTag ("MainCamera"))
{
Destroy (gameObject);
}
}
and still nothing
please help me!