Attack multiple Trees

Hello, this is Mahsa

I am creating a feature that player cut multiple trees at once
I play the attack animation when a tree or multiple trees enter my trigger
but the problem is when it comes to multiple trees it won’t continue the attacking
Here’s how

[SerializeField] PlayerData playerData;
[SerializeField] PlayerTileCollector collector;

public List<Damageable> damageableList = new List<Damageable>();

private int attackLayerIndex;
public float damageAmount = 0.1f;


private void Awake()
{
    attackLayerIndex = playerData.playerAnimator.GetLayerIndex("Attack");

}


private void OnTriggerEnter(Collider other)
{
    var tree = other.gameObject.GetComponent<Damageable>();
    if(!tree) return;

     damageableList.Add(tree);

    if(tree.tag == "Tree")
    {
        playerData.axe.gameObject.SetActive(true);

        //Debug.Log("In");

        playerData.playerAnimator.SetLayerWeight(attackLayerIndex, 1f);
        playerData.playerAnimator.SetTrigger("Attack");
    }
}



private void OnTriggerExit(Collider other)
{
    var tree = other.gameObject.GetComponent<Damageable>();
    if(!tree) return;

     damageableList.Remove(tree);

    if(tree.tag == "Tree")
    {
        playerData.axe.gameObject.SetActive(false);
        playerData.playerAnimator.SetTrigger("Stop");
        //Debug.Log("Out");
    }
}

public void PlayerAttack()
{

    foreach(var tree in damageableList)
    {
        tree.TreeTakeDamage(damageAmount, collector);
    }

   
}

Trees take damage in another script for their health

@Moiny , It might be because you are stopping animation in OnTriggerExit method without checking if any other tree is in the damageableList. If you need to SetTrigger("Stop"), then check it like this,

if(damagableList.count == 0)
{
    playerData.axe.gameObject.SetActive(false);
    playerData.playerAnimator.SetTrigger("Stop");
    //Debug.Log("Out");
}

This will make your attack continue if at least one tree (or damageable) item is in you damageableList.