OnTriggerStay2D not working

I am trying to make a flamethrower weapon for my player character. I am using a system were I can change between weapons, and every other weapon works perfectly. The flamethrower is able to turn on its particle system, but the OnTriggerStay2D that I am using to detect if the flames are hitting an enemy is not working. From other answers to similar questions, I have seen that it is commonly due to there not being a Collider and/or Rigidbody, and I have both. (CapsuleCollider2D, with" is trigger" set to true, in the shape of the area the flames occupy)

Here is my code:

void OnTriggerStay2D(Collider2D other)
{
   Debug.Log("Flamer collision");
   if (isFlamer && canshoot && flamerOn && other.gameObject.CompareTag("enemy"))
   {
       Debug.Log("flamer firing");
       if (timeBtwShots == 0)
       {
           Debug.Log("flamer damage applying");
           health = other.GetComponent<EnemyHealth>().health;
           Debug.Log(other.name + " health: " + health);
           health -= damage;

           timeBtwShots = startTimeBtwShots;
           Instantiate(ash, other.transform);
       }
       else
       {
           timeBtwShots -= Time.deltaTime;
       }

   }
}

I am not receiving any error messages or Debug.Logs in the console.

The rest of the code works, and is just to turn the particle system on and off, aim the flamethrower, and turn the flamethrower on and off.

The 2D physics system reports when it comes into contact with colliders, not particles. If you want to know when particles collide/overlap with stuff then you use the particle system API. That’s not a 2D feature but look at the particle docs for the collision/trigger modules and its callbacks.

I am not trying to get it to collide with particles, I am trying to get it to collide with colliders mate. The particles are there to represent the flames, and are purely a visual element of the game, and don’t interact with anything, and I don’t want them to interact with anything.

Okay so you have a CapsuleCollider2D but where are these other Colliders which you don’t mention in your original post? You only talk about particles which are nothing to do with Colliders, 2D or Physics so it’s not clear why you’re mentioning them then.

Please elaborate.

I have referred to the other colliders, they are on the enemies that I mention in paragraph 1, line 3. I have referred to the particles 2 times in my original post in order to contextualise my issue, and to explain what I am using the capsulecollider2d on the flamethrower for, which is to detect any enemies (which have capsuleCollider2Ds) that move within the area of effect of the flamethrower. The particles are the visual representation of the flames that the flamethrower produces, and the actual flames are not mentioned even once in the code snippet I have supplied. Thank you for your concern about my usage of the particle system, but as you yourself said, it has nothing to do with collision detection.

If you want, I can supply the full code of the flamethrower (the rest of which is not relevant to my specific issue).

9228315--1288836--1264944-9c8e17e6d021916bd11fffa3d1dfe727.png