Activate when variable equals 10

I am trying to make a script where once the variable “score” equals 10 it loads a level called “Level 1”. All the scripts i try do not work so I need help.

I have most thing down. I'm just new to variables. Can you give me a link to where I can learn how to do it or tell me

2 Answers

2

for detecting when a variable reaches a certain amount us an if statement. So you could say:

if(score == 10){
//load level 
}

Is important to us ‘==’ and not just ‘=’ as one is using for checking if one value equals another and the other is used for setting variables.
As for loading levels I would check out these tutorials: https://www.youtube.com/watch?v=QLaIlcJbxTk and https://www.youtube.com/watch?v=WfPH5Ey0Gcg

if(score==10)
Application.LoadLevel(“Level 1”);

Thanks you! It didn't work but I think it was a different error. Check it out: http://answers.unity3d.com/questions/581965/adding-varibales-from-other-scripts.html