how do i fix not being able to click properly in my clicker game?

i have recently been trying to make a clicker game but when I click, my counter doesnt go up. I use left click, right click and space button as my clicking buttons. I can only make the counter go up when i click space. I have tried to use just left click and remove space and right click but now the counter just doesnt go up when i click (as i expected)

Here is my code

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

public class BlockCounter : MonoBehaviour
{

    public static int ScoreValue = 0;
    Text score;

    // Start is called before the first frame update
    void Start()
    {
        score = GetComponent<Text>();
    }

    // Update is called once per frame
    public void OnClick1()
    {
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            ScoreValue += 1;
        }
            score.text = "Blocks: " + ScoreValue;
    }

    public void OnClick2()
    {

        if (Input.GetKeyDown(KeyCode.Mouse1))
        {
            ScoreValue += 1;
        }
        score.text = "Blocks: " + ScoreValue;
    }

    public void OnClick3()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            ScoreValue += 1;
        }
        score.text = "Blocks: " + ScoreValue;
    }


}

Hello!

I can see that you’re not using actually update method to check your input… you just made 3 voids that are never used

so i remade your code

public static int ScoreValue = 0;

Text score;

// Start is called before the first frame update
void Start()
{
    score = GetComponent<Text>();
}

// Update is called once per frame
private void Update()
{
    if (Input.GetKeyDown(KeyCode.Mouse0) || Input.GetKeyDown(KeyCode.Mouse1) || Input.GetKeyDown(KeyCode.Space))
    {
        OnClick();
    }
}

public void OnClick()
{
    ScoreValue += 1;
    score.text = "Blocks: " + ScoreValue;
}

you still have the OnClick method to call it from outside if you need.

Hope this helps!