How can I call functions in multiple scripts, if they have the same name?

I’m trying to code my dialogue system in Unity.

I have one script called DialogueManager, which works with the UI, sound, scrolling through text, and ending the dialogue when it is complete. The DialogueManager is attached to an empty game object.

Then, I have a DialogueTrigger scripts on each of my NPCs that can be talked to. It handles the collider which allows you to talk to the NPC, the inputs, and the animations for that NPC.

The issue is, my DialogueManager needs to communicate with DialogueTrigger to trigger a function which ends animations, but “FindObjectOfType()” only calls the script to end the talking animation on one of my NPCs, so the others never finish their animations.

Figured it out:

    DialogueTrigger[] DialogueTriggerList = GetComponentsInChildren<DialogueTrigger>();
    foreach (DialogueTrigger tg in DialogueTriggerList)