Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.SceneManagement;
- public class gamemaster : MonoBehaviour {
- public int points = 0;
- public int highscore = 0;
- public Text pointtext;
- public Text Hightext;
- public Text Inputtext;
- // Use this for initialization
- void Start () {
- Hightext.text = ("HighScore: " + PlayerPrefs.GetInt("highscore"));
- highscore = PlayerPrefs.GetInt("highscore", 0);
- if (PlayerPrefs.HasKey("points"))
- {
- Scene ActiveScreen = SceneManager.GetActiveScene();
- if (ActiveScreen.buildIndex == 0)
- {
- PlayerPrefs.DeleteKey("points");
- points = 0;
- }
- else
- points = PlayerPrefs.GetInt("points");
- }
- }
- // Update is called once per frame
- void Update () {
- pointtext.text = ("Points: " + points);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement