16a190949d
also tried to create a way to launch the game from any scene, but it doesn't really work. don't use anything in the folder called "DEBUG"
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DEBUG_persistent_data : MonoBehaviour
|
|
{
|
|
|
|
[Header("PERSISTENT DATA OBJECTS")]
|
|
[SerializeField] GameObject stateControllerPrefab;
|
|
[SerializeField] GameObject sceneManagerPrefab;
|
|
[SerializeField] GameObject debugCanvasPrefab;
|
|
|
|
void Start() {
|
|
// check to see if a DEBUG already exists
|
|
if (GameObject.FindGameObjectWithTag("DEBUG") != null) {
|
|
Destroy(this.gameObject);
|
|
} else { // if it doesn't, then this is the only one
|
|
this.gameObject.tag = "DEBUG";
|
|
}
|
|
|
|
|
|
// create persistent data, state controller, scene manager if they don't exist
|
|
if (GameObject.FindGameObjectWithTag("StateController") == null) {
|
|
Instantiate(stateControllerPrefab);
|
|
}
|
|
if (GameObject.FindGameObjectWithTag("SceneManager") == null) {
|
|
Instantiate(sceneManagerPrefab);
|
|
}
|
|
if (GameObject.FindGameObjectWithTag("DebugCanvas") == null) {
|
|
Instantiate(debugCanvasPrefab);
|
|
}
|
|
|
|
}
|
|
}
|