Collider is not recognizing multiple objects

i made an ability to freeze the enemies(dusman) that got in to the area of a collider .But when i use the ability some enemies that are on top of each other didnt get the effect . What am i doing wrong?

  void OnTriggerStay2D(Collider2D hitInfo)
    dusman dusman = hitInfo.GetComponent<dusman>();
    if (dusman != null && countdown > 5)
        countdown1 = 0f;
        reset = true;
        if (reset == true && attack == true)
            reset = false;
            attack = false;

OnTriggerStay is executed when an object enters the trigger and stays in it, its sort of like the Update() function - unlike Enter or Exit which trigger, of course, when an object enters or exits the trigger.

In this case, i think using OnTriggerEnter2D would work better since it can be triggered once every time a new object enters the trigger, and not repeat every frame.

If this doesn’t fix it, then it might be an issue with the enemies themselves, in which case you should do a Debug.Log for every enemy and check if they are being correctly detected in the trigger.