- Home /
Question by
chiltonwizard · Apr 04, 2018 at 10:58 PM ·
levels
how to get match 3 game to change levels when a score is reached,how to make match 3 game change levels
how to get match 3 game to change levels when a score is reached,how to make match 3 game change levels
Comment
Answer by ClumsyLobster · Apr 04, 2018 at 11:58 PM
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html
using UnityEngine;
using UnityEngine.SceneManagement;
public class ExampleClass : MonoBehaviour {
public int Score;
void Awake() {
Score = 0;
}
void Update() {
// increase the Score
Score += 1;
// when Score reaches 10, load next scene
if (Score == 10) {
LoadNextScene();
}
}
void LoadNextScene() {
// Load next scene by its Build Index
SceneManager.LoadScene(1,
LoadSceneMode.Single);
}
}
Your answer
Follow this Question
Related Questions
New scene for minigame or not? 1 Answer
Display Audio Analysis and levels with objects 0 Answers
when i click the GUI button it doesnt load the level 1 Answer
Unity Serializer Wont Load Saves 1 Answer
Load previous scene 1 Answer