How do I change an variable value if I click on a UI button?

I want whenever I click on a button a specific int variable to change it’s value(during runtime).

Write a function and set up the button to call it with OnClick Event.

I created the function added it to the gameObject but it still doesn’t appear in the UI functions I putted the gameObject that hold’s the script in the UI button and the script name appears but the int variable’s name doesn’t.62053-second.png