using UnityEngine;
using System.Collections;
public class Score : MonoBehaviour {
static int score = 0;
static int highScore = 0;
static Score instance;
static public void AddPoint() {
if(instance.bird.dead)**ERROR**
return;
score++;
if(score > highScore) {
highScore = score;
}
}
BirdMovement bird;
void Start() {
instance = this;
GameObject player_go = GameObject.FindGameObjectWithTag("Player");
if(player_go == null) {
Debug.LogError("Could not find an object with tag 'Player'.");
}
bird = player_go.GetComponent<BirdMovement>();
score = 0;
highScore = PlayerPrefs.GetInt("highScore", 0);
}
void OnDestroy() {
instance = null;
PlayerPrefs.SetInt("highScore", highScore);
}
void Update () {
GetComponent<GUIText>().text = "Score: " + score + "
ERRORHigh Score: " + highScore;ERROR
}
}
Writes can not determine
help
version of the Unity Unity 5.1.1f1 (64-bit)