Agree with Spiney, but it also might be this issue: putting the actual script in the field rather than the script instance, which I have actually observed can sometimes have bizarre effects in the editor inspector onclick graphics, depending on Unity version.
Unity button onclick function script callback gameobject notes:
And just for completeness, the rest of my tips on hooking up these events…
For sliders and dropdowns and other value-returning UI elements:
And passing “more interesting” things when buttons are pressed: