unity onlick function not showing

I have this code for a rock paper scissor game, its just the beginning, I’m trying to attach an onlick to my object but i cannot find the function in the scroll…

here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Gamemanager : MonoBehaviour
{
enum elements { Scissor , Paper , Rock}

private int playerChoose = -1;
private int botChoose = -1;

private bool playersTurn = true;

// Update is called once per frame
void Update()
{
    if (playersTurn && playerChoose == -1) return;
}

public void playerChoose (int choose)
{
    playerChoose = choose;
}

}

I would really appreciate some help… thank you

in the button / onClick component, hit the ‘+’ then drag in the gameobject with your script on it to that slot, then you should see a dropdown with all the call-able functions from any scripts on that gameObject.
If you still dont see your function try making it public.

I think I know. For some reason you can add a function with zero or one parameter.

public void add(); works
public void add(int a); works
public void add(int a, int b); doesn’t show up

I’m thinking a way around that is using the older Ongui functions to handle that, but haven’t tested yet.

You have given your variable and your method the same name:

private int playerChoose = -1;

public void playerChoose (int choose)
{
    playerChoose = choose;
}

While overloading members is allowed when they differ in their signature, it can cause tons of issue with serialization systems. You generally should avoid this.