Enemy bullets pass through my walls

I’ve been wanting to make a retro fps game for a long time and now, I finally have time to start it, so i looked up on the internet for tutorials to start understanding its mechanics and I found a whole series containing everything I needed to know. After following it very closely, everything seems to work but one thing. My enemies shoot bullets, those bullets have a 2D circle collider which acts as a trigger, and a rigidbody 2D set to kinematic. My walls have 2D box colliders and yet those bullets pass through the walls like they were nothing!

Here are a couple of screenshots of my scripts and editor:

This is the inspector for my bullet game object:

and here is the one for my wall :

and here is the script for my bullet :
public class EnemyBullet : MonoBehaviour
{
public int damageAmount;
public float bulletSpeed = 3f;
public Rigidbody2D theRB;
private Vector3 direction;

// Start is called before the first frame update
void Start()
{
    direction = PlayerController.instance.transform.position - transform.position;
    direction.Normalize();
    direction = direction * bulletSpeed;
}

// Update is called once per frame
void Update()
{
    theRB.velocity = direction * bulletSpeed;
}

 void OnTriggerEnter2D(Collider2D other){
    if(other.tag == "Player"){
        PlayerController.instance.TakeDamage(damageAmount);
        Destroy(gameObject);
    }

}

}

Any help given is super appreciated and I thank you for taking your time to read this. Let me know if you need more details :slight_smile:

You have to set the Rigidbody2D’s collision detection mode to continuous because discrete collision will cause small fast objects to go through thin walls.

I FOUND MY SOLUTION!

My solution was to add this to the trigger void:

private void OnTriggerEnter2D(Collider2D other){
if(other.tag == “Player”){
PlayerController.instance.TakeDamage(damageAmount);
Destroy(gameObject);
}else if(other.tag == “Wall” || other.tag == “Door”){
Destroy(gameObject);
}

}