Hello Everyone!
I’m working about a month on a project, wich i started out from the Roll a Ball Tutorial, here from unity! 
but now i’m facing a problem…
i want the player to need different Scores on every level, for example…
Level 1 = 10 Points to Pass.
Level 2 = 20 Points to Pass.
and so on…
but i can only define the Value as a fixed number… for example, if i put “100” the player will need 100 points even in Stage 1.
if someone can help, please do ! 
i think i should change something around here:
void SetCountText ()
{
countText.text = "Count: " + count.ToString ();
if (count >= 100)
{
int i = Application.loadedLevel;
Application.LoadLevel(i + 1);
winText.text = "You Win!";
}
}
It’s not really clear specifically which portion you’re struggling with. I think I get what you want to achieve overall, but I’m not sure which things you understand and which you don’t. I’m thinking what you’re asking is how to make the required points dynamic depending on which scene (level) you’re on.
The thing you want here is called a variable, and it’s pretty much the first thing you learn when starting with any programming language. The following two snippets of code would do the same thing:
// Version 1
int count = 0;
if (count >= 100) {
// Do stuff
}
// Version 2
int count = 0;
int requiredScore = 100;
if (count >= requiredScore) {
// Do stuff
}
With the advantage of Version 2 being that you can change the requiredScore variable each level (or set it dynamically, or whatnot). Setting explicit values (like in Version 1) is referred to as using Magic Numbers, and it’s generally to be avoided, anyway.
It’s great that you’re expanding on Roll A Ball and adding stuff to it! I also strongly recommend you learn as much code on the side as you can, which will really allow you to customize games (And create new ones!) to your heart’s content.
Expanding on what @Schneider21 has said, if you have an int that keeps track of the level/phase that starts at 1 you can have an int for the required score as a formula of eg 100*level. Then use an if statement to say if the score is >= required score then level = level +1
This way the required score will keep increasing as the level increases. If you are passing the player between scenes & reusing the code on each scene look at using playerprefs to store the player level & save the new level to the player prefs before loading the new scene. Then on start in the new scene get the value from the player prefs
1 Like