Unity SetTrigger not working

I’m currently trying to get an animation to play when you click a button, the idea is that it’ll zoom the camera in on an object in the scene. Here’s my script

public class MainMenuManager : MonoBehaviour
{
    public Animator StartAnimation;

    [SerializeField] GameObject MainMenu;
    [SerializeField] GameObject SettingsMenu;

    public void Start()
    {
        StartAnimation = GetComponent<Animator>();

        MainMenu.SetActive(true);
        SettingsMenu.SetActive(false);
    }

    public void PlayGame()
    {
        MainMenu.SetActive(false);
        StartAnimation.SetTrigger("BeginGame");
    }

    public void OpenSettings()
    {
        SettingsMenu.SetActive(true);
        MainMenu.SetActive(false);
    }

    public void QuitGame()
    {
        Application.Quit();
    }
}

I thought it should be working, but inside the editor it won’t activate the trigger when you click the play button. I’ve added on an onClick event, but it just won’t work. (Version Unity 20219.4)

Is it a canvas UI button, was the function set?

I Figured out I didn’t need the whole animator component at all! All I needed to do was add an onClick event to my Play button, drag in the Main Camera, then set Animator type to string, and set the name of the Animation itself! (Not the Trigger)