i have a code but if i click , it returns gameover if the capsule is coloured and when it is not.
i can’t solve this, please help, Thanks.
using UnityEngine;
using System.Collections;
public class Click : MonoBehaviour {
int score;
public Material[] culoare = new Material[2];
void OnMouseDown() {
if (GetComponent<Renderer> ().material == culoare [1]) {
score++;
Debug.Log (score);
} else {
GameOver ();
}
}
void GameOver(){
Debug.Log ("Game Over");
}
}