- Home /
Question by
El-Deiablo · May 11, 2016 at 10:05 AM ·
scenescoredisplaygameover
Show Current Score on GAMEOVER Scene
I have several scripts created, but I am having a difficult time figuring out how to make this work. I want the score that is accumulated from the gameplay scene to display on the GAMEOVER scene.
Here's my current code:
using UnityEngine;
using System.Collections;
using UnityEngine .UI;
using UnityEngine .SceneManagement ;
public class ScoreManager : MonoBehaviour {
public ScoreManager scoreManager;
public Text scoreText;
public Text TKOText;
public static float scoreCount;
public static float TKOCount;
public float pointsPerSecond;
public bool scoreIncreasing;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (scoreIncreasing) {
scoreCount += pointsPerSecond * Time.deltaTime;
}
if (TKOCount > 2) {
Destroy (GameObject .FindGameObjectWithTag ("Player"));
SceneManager.LoadScene ("Buck Bite Tyson GameOver Scene");
}
scoreText.text = " " + Mathf.Round (scoreCount);
TKOText.text = " " + TKOCount;
}
}
Code 2:
using UnityEngine;
using System.Collections;
using UnityEngine .UI;
public class GAMEOVERManager : MonoBehaviour {
public Text scoreText;
// Use this for initialization
void Start () {
scoreText = ScoreManager.scoreCount;
}
// Update is called once per frame
void Update () {
}
}
Comment
Your answer
Follow this Question
Related Questions
Timer Score display on Game Over Scene? 1 Answer
Level end after certian amount of points collected 2 Answers
Display a text for all scenes 2 Answers
How do I create multiple save files and make it work? 2 Answers
Time Score? 1 Answer