Hey so I’m having trouble making a bullet get destroyed when it hits a wall. No sure if it’s the code or I’m not using the right components. Here’s my current code that I put on the wall prefab:
void OnCollisionEnter2D(Collision2D col)
{
//Check collision name
Debug.Log("collision name = " + col.gameObject.name);
if (col.gameObject.name == "Bullet")
{
Destroy(col.gameObject);
}
}