Hi,
I got problems with my Game over screen. I think the problem is related to my Timer and scene manager. I am saving my timer with scene manager in the game.
So when I am playing the game, it throws me in the game over scene when the time is up. It works perfectly but for some reason nothing works in Game Over scene. I cant press buttons etc. When I don’t use scene Manager in order to save timer through scenes buttons works perfectly. Also buttons are working if I go to Game over scene through next scene buttons.
(SceneManager)
using UnityEngine;
using System.Collections;
public class SceneManager1 : MonoBehaviour{
static SceneManager1 Instance;
void Start ()
{
if (Instance != null)
{
GameObject.Destroy (gameObject);
}
else
{
GameObject.DontDestroyOnLoad(gameObject);
Instance = this;
}
}
}
(TimeManager)
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class TimeManager1 : MonoBehaviour
{
public float startingTime;
private Text theText;
public GameObject gameOverScreen;
void Start ()
{
theText = GetComponent<Text> ();
if (Application.loadedLevelName != "Scene1") {
startingTime = PlayerPrefs.GetFloat ("timer", startingTime);
}
}
// Update is called once per frame
void Update () {
startingTime -= Time.deltaTime;
if (startingTime <= 0)
{
Application.LoadLevel("GameOver");
Time.timeScale = 0;
}
theText.text = "" + Mathf.Round (startingTime);
}
}