Advertisement
Guest User

scoree

a guest
Nov 1st, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. //namespace CompleteProject
  6. //{
  7. public class ScoreManager : MonoBehaviour
  8. {
  9. public static int score; // The player's score.
  10.  
  11.  
  12. Text text; // Reference to the Text component.
  13.  
  14. void Start (){
  15.  
  16. score = PlayerPrefs.GetInt ("skorum"); //PlayerPrefs.GetInt ("skorum", score);
  17. }
  18. void Awake ()
  19. {
  20.  
  21. //PlayerPrefs.SetInt("skorum",score);
  22.  
  23. // Set up the reference.
  24. text = GetComponent <Text> ();
  25.  
  26. // Reset the score.
  27. score = 0;
  28. }
  29.  
  30.  
  31. void Update ()
  32. {
  33. PlayerPrefs.SetInt ("skorum", score);
  34. // Set the displayed text to be the word "Score" followed by the score value.
  35. //text.text = "" + score;
  36. text.text = "" + score;
  37. }
  38. }
  39. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement