So i made timer that when it reaches 0 it loads a new scene. the script for the scene change is attached to an empty gameobject called Game Manager and isn’t destroyed on load. the problem is: when the new scene loads any gameobjects other than Game Manager is labeled as “deleted gameobject”. The objects remain in the scene but cant be selected, and don’t run any scripts. Heres the script that attached to the Game Manger:
using UnityEngine;
using System.Collections;
public class gameManager : MonoBehaviour {
public static int currentScore;
public static int highScore;
public static int currentLevel = 0;
public static int unlockedLevel;
public GUISkin Skin;
public Rect timerRect;
public float startTime;
private string currentTime;
void Update(){
startTime -= Time.deltaTime;
currentTime = string.Format ("{0:0.0}", startTime);
if (startTime <= 0) {
startTime = 0;
Application.LoadLevel (3);
}
}
void Start (){
DontDestroyOnLoad (gameObject);
}
public static void completeLevel (){
if (currentLevel < 2) {
currentLevel += 1;
Application.LoadLevel (currentLevel);
} else {
print ("You Win!");
}
}
void OnGUI() {
GUI.Label (timerRect, currentTime);
}
}
here’s the first scene (with Game Manger circled):
And here the second scene. BTW there’s only one object in the scene which is the camera:
Please help I’ve been stuck on this for a while.