I need to load my scene . The singleton script is attach to a UI text . I gotten an error when I have the destroyonload. Here is my script :
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class GameManagerSingleton : MonoBehaviour
{
public static GameManagerSingleton instance = null;
public static int score;
private Text text;
void Awake()
{
text = GetComponent <Text> ();
score = 0;
if (instance != null && instance != this)
Destroy(gameObject); // Ensures that there aren't multiple Singletons
instance = this;
}
void Update()
{
text.text = "Score: " + score;
Debug.Log("Score: " + score);
}
}