- Home /
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
Answer by TheLivingTree · Nov 23, 2013 at 06:44 PM
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
Answer by ffxz7ff · Nov 23, 2013 at 05:49 PM
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
Your answer
![](https://koobas.hobune.stream/wayback/20220613122558im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Need to use 2 different language scripts. 1 Answer
Static Variable Problem 1 Answer
Access a JavaScript variable from a C# script? 2 Answers
Change GUI Value with Variable 1 Answer