Search Unity

if than and less problems!

Discussion in 'Scripting' started by haldy, Oct 24, 2014.

  1. haldy

    haldy

    Joined:
    Oct 19, 2013
    Posts:
    3
    Hey! I can not get this script to work! One of parts of the script will not work when called! Please help a C# beginner!

    Code (CSharp):
    1.             highscorefor10 = PlayerPrefs.GetInt("highscore10");
    2.  
    3.      
    4.  
    5.             if(clickCount > highscore10){ // WORKS
    6.                      
    7.                          PlayerPrefs.SetInt("highscore10", clickCount);
    8.                          GUI.Label (new Rect (45, 150, 400, 400), "New highscore");
    9.                          GUI.Label (new Rect (120, 170, 400, 400), "" + clickCount);
    10.                          PlayerPrefs.Save();
    11.                       if(GUI.Button(new Rect(25,5,75,30), "Upload")) {
    12.                          Application.LoadLevel("mouseboard10");
    13.                  
    14.                  
    15.                       }
    16.        
    17.              
    18.                       }
    19.             else if(clickCount < highscore10) // DONT WORK FROM HERE
    20.             {
    21.                 GUI.Label (new Rect (45, 200, 400, 400), "Highscore: " + highscorefor10);
    22.                 GUI.Label (new Rect (45, 150, 400, 400), "Score: " + clickCount);
    23.                 if(GUI.Button(new Rect(130,5,120,30), "Restart")) {
    24.                     Application.LoadLevel(bane);
    25.                 }
    26.                 if(GUI.Button(new Rect(25,5,75,30), "Menu")) {
    27.                     Application.LoadLevel("StartMenu");
    28.                  
    29.                 }
    30.  
    31.             }
     
    Last edited: Oct 24, 2014
  2. Deleted User

    Deleted User

    Guest

    Please point out what part of the script is not working.
     
  3. haldy

    haldy

    Joined:
    Oct 19, 2013
    Posts:
    3
    Sorry! Part 2 (added notes).