Hey guys, I need help
I have created a small demo in Unity 2d, but when trying to destroy the game objects (basic game logic is - destroy moving objects) that are moving from above - OnTriggerEnter2D
is not destroy it. Looks like it’s not on a similar layer.
DetectCollisions.cs
public class DetectCollisions : MonoBehaviour
{
void Start()
{
}
void Update()
{
// Destroy an objects
}
void OnTriggerEnter2D ( Collider2D other )
{
Debug.Log("Enemy");
Destroy(gameObject);
Destroy(other.gameObject);
}
}
What can be the issue? Maybe someone has similar things