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;
}
}