- Home /
Question by
Agriggs · Feb 12, 2014 at 11:37 PM ·
beginnerload level
How do i load my next level?
i wrote out a function so when currentScore == 6 it loads level 2, but it wont do it.why?
here's the script:
#pragma strict
static var currentScore : int = 0;
var offsetY : float = 40;
var sizeX : float = 100;
var sizeY : float = 40;
function Start (){
currentScore = 0;
}
function OnGUI (){
GUI.Box (new Rect (Screen.width/2-sizeX/2, offsetY, sizeX, sizeY), "Score: " + currentScore);
}
function LoadLevel()
{
if (currentScore == 6){
Application.LoadLevel("Level 2");
}
}
Comment
Best Answer
Answer by ProtoTerminator · Feb 13, 2014 at 01:43 AM
Change function LoadLevel() to function Update()
No problem. You should set the question as answered.
Your answer
Follow this Question
Related Questions
Unity blue screen help? (Can't add scenes) [fixed] 2 Answers
Beginner please help. NullReferenceException: Object reference not set to an instance of an object 3 Answers
move object help [beginner] 1 Answer
Help getting the target and camera rotation to match 0 Answers
Leap Motion Boilerplate Asset Standard Gesture Support? 0 Answers