added a debug mode variable to state controller
if this is checked, then the debug menu will be useable. when building the game, make sure to uncheck the debug mode box to prevent it from coming up in the build
This commit is contained in:
parent
5216ea077a
commit
8dd536f254
@ -2400,6 +2400,7 @@ MonoBehaviour:
|
||||
deathCanvas: {fileID: 0}
|
||||
isPaused: 0
|
||||
pauseMenuCanvas: {fileID: 0}
|
||||
inDebugMode: 1
|
||||
--- !u!114 &2038492347
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -8,6 +8,9 @@ public class DebugSceneSwitcher : MonoBehaviour
|
||||
{
|
||||
|
||||
void Awake() {
|
||||
if (!GameObject.Find("StateController").GetComponent<StateController>().inDebugMode) {
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
// check to see if a debug canvas already exists
|
||||
if (GameObject.FindGameObjectWithTag("DebugCanvas") != null) {
|
||||
Destroy(this.gameObject);
|
||||
|
@ -15,6 +15,8 @@ public class StateController : MonoBehaviour {
|
||||
public bool isPaused = false;
|
||||
public GameObject pauseMenuCanvas;
|
||||
|
||||
[Header("Debug")]
|
||||
public bool inDebugMode;
|
||||
GameObject debugCanvas;
|
||||
|
||||
void Awake() {
|
||||
@ -27,8 +29,10 @@ public class StateController : MonoBehaviour {
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
|
||||
debugCanvas = GameObject.Find("DebugCanvas");
|
||||
debugCanvas.SetActive(false);
|
||||
if (inDebugMode) {
|
||||
debugCanvas = GameObject.Find("DebugCanvas");
|
||||
debugCanvas.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
|
||||
@ -52,7 +56,9 @@ public class StateController : MonoBehaviour {
|
||||
}
|
||||
|
||||
void OnToggleDebugMenu() {
|
||||
debugCanvas.SetActive(!debugCanvas.activeSelf);
|
||||
if (inDebugMode) {
|
||||
debugCanvas.SetActive(!debugCanvas.activeSelf);
|
||||
}
|
||||
}
|
||||
|
||||
void OnPause() {
|
||||
|
Loading…
Reference in New Issue
Block a user