Input.GetButton(...) compared to a Button with Event Trigger - calling same method but functioning differently

This is making me sad.
Background: I’m in the process of converting a keyboard / mouse controlled game into something that can be controlled via buttons in the UI so that it can be played on Mobile. Added a load of buttons to my UI, and turned my player controller script into functions so that they can be called. Changed my player controller script to call all these functions to make sure that they work correctly, and they do. Started to set up buttons with Event triggers to call the same functions, but getting different results despite it running the same code.

IN PLAYER SCRIPT:

public bool isGrounded;

Update {
	isGrounded gets set here based on some Physics2D overlap check.
	if (Input.GetButton("jump")) { Call function A } 
}

Function A {
	if (isGrounded) { jumping code; }
}

ON BUTTON ON MY CANVAS:

On a button with an EventTrigger for PointerDown > call PlayerScript > Function A.

“jump” has been set to space within the Project Settings > Input menu.


THE PROBLEM:
Space does the jumping code. It gets into function A, passes the isGrounded check.
Clicking button doesnt. Button gets into function A, but fails the isGrounded check.

isGrounded is only changed within the update method. I really am lost why this isn’t happening. I’ve debug.log’d to test it’s getting into the function - it is! it’s just failing the boolean check for what would appear to be no reason.

Any ideas?

Fixed this for anyone interested.

The Event Trigger, when passed the player in order to choose function A, seemed to be getting a reference just to the player class - not the instance of the player that existed in the world.

To fix this, I moved all the functions I wanted to link my buttons to into a UIButtonManager. Upon pressing button, it’d call function in the UIButtonManager. This UI button manager would get a reference to the current player on awake. It would then call function A on the player: player.FunctionA(); This fixed it.