Button UI, OnClick() - Calling Bool Function

So I’ve been working on a basic script that basically just confirms a decision that’s made in a earlier in the Project (it’s a chess game where you can forfeit the game, but I feel the decision needs a confirmation button to prevent costly misclicks). So, I thought I’d be smart and make it just a simple generic script that works for all my buttons (there’s a few of them) to make life easier and to further myself in Coding in general. Here’s my code:

Script that goes on the original button that starts the forfeit

public class UIOffer : MonoBehaviour
{
    public GameObject confirm;
    public UIConfirm confirmScript;

	public void Clicked () //Makes decision
    {
        if(gameObject.layer == 9 && gameObject.tag == "Forfeit")
        {
            confirmScript = confirm.GetComponentInChildren<UIConfirm>();
            confirm.active = true;
            confirmScript.confirmForfeit();
            if(confirmScript.confirmForfeit())
            {
                Manager.status = "CheckMate"; // Lose
            }
        }
    }
}

Second script that confirms/denies the forfeit made in the first and returns it to the first

public class UIConfirm : MonoBehaviour
{

    public bool confirmOffer() //Confirms decision
    {        
        return true;        
    }

    public bool confirmForfeit() //Cancels decision
    {
        return false;
    }
}

My problem is that when I go into Unity, the functions aren’t there under the ‘OnClick()’ component. I changed the "bool"s in the second script to “void”, and the script appeared, and I could run the functions on the various buttons that I have - but they don’t return a bool (obviously), which I do quite need. From this, I guessed that: either I’ve made a very stupid mistake (it would most definitely not be the first time), or Unity doesn’t have a way to call a bool function off a UI button. Is there a way around it, or do I just need to try find a completely different way around this problem?

Any help is greatly appreciated, this has been ‘bugging’ me for a while, and it’d be great to get it out of the way :slight_smile:
Cheers in advance.

You can’t return a bool from the on click methods, so instead write a void function that gives you the bool (I.e set the bool to what you need in the void and at the end of that void call the method that does the stuff or checks you need on that bool.

E.g

Void OnClickThing()
{
Bool x = true;
BoolFunction(x);
}