Hi guys,
I’m trying to load the new level once the score equals 100.
I wrote this script, but nothing is happening once I reach 100, could you advise?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public Text scoreText;
private int score;
void Start()
{
score = 0;
UpdateScore();
}
public void PlayNextLevel ()
{
if (score >= 100)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
}
}