How to cancel SetTrigger On animator?

I used Reset ResetTrigger() can’t cancel the SetTrigger.it will continue to be triggered.thanks!`

                    UnityEditorInternal.AnimatorController ac = 
                    animator.runtimeAnimatorController as UnityEditorInternal.AnimatorController;

                    UnityEditorInternal.StateMachine sm = ac.GetLayer(0).stateMachine;

                    for (int i = 0; i < sm.stateCount; i++ )
                    {
                        animator.ResetTrigger(i);
                    }

                    animator.Play("idle");
                    animator.SetTrigger(animName);

ResetTrigger turns off an animation trigger that is currently on.

if(playerAmmo == 4 && timeDelay == 30)
	{
	ammoController.GetComponent(SpriteRenderer).sprite = fourBullets;
	playerAnim.ResetTrigger("Reload");
	playerAnim.SetTrigger("Idle");
	}

In this example (Javascript) I’m using ResetTrigger to disable the “Reload” animation before triggering the “Idle” animation. Before I added the ResetTrigger code the animations would play over the top of one another as one ended and the other began since both triggers were active.

I’m afraid I can’t give exact feedback to your code as using the request in an array might work, but only if the requested trigger is active I believe.