Hello. I am trying to make a little game where the higher score you get, the harder the game becomes.
public class ScoreController : MonoBehaviour {
private float score;
public GUIText scoreText;
private GameObject asteroidController5;
void Start()
{
score = 0;
asteroidController5 = GameObject.FindWithTag("ASC0-5");
}
public void AddScore(int newScoreValue)
{
score += newScoreValue;
UpdateScore();
}
void UpdateScore()
{
scoreText.text = "Score: " + score;
}
void Update()
{
if(score == 5)
{
asteroidController5 = gameObject.SetActive(false);
}
}
}
As you can see I have the score script ready and working but when trying to disable a specific gameObject once it reaches 5, Unity brings up this error message: "Cannot implicitly convert type ‘void’ to ‘UnityEngine.GameObject’
Can anyone help me?
Thank you!