diff options
Diffstat (limited to 'td/Assets/Scripts/developerMode.cs')
-rw-r--r-- | td/Assets/Scripts/developerMode.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/td/Assets/Scripts/developerMode.cs b/td/Assets/Scripts/developerMode.cs new file mode 100644 index 0000000..b0d7704 --- /dev/null +++ b/td/Assets/Scripts/developerMode.cs @@ -0,0 +1,48 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine.UI; +using UnityEngine; + +public class developerMode : MonoBehaviour { + + public string output = ""; + public string stack = ""; + + bool developerModeActive; + GameObject pnlCanvas; + Text lblConsoleLog; + + void Start () { + pnlCanvas = transform.Find ("Canvas").gameObject; + lblConsoleLog = pnlCanvas.transform.Find ("consoleLog").gameObject.GetComponent <Text>(); + + lblConsoleLog.text = ""; + } + + void Update () { + + if (PlayerPrefs.HasKey ("developerMode")) { + if (PlayerPrefs.GetInt ("developerMode") == 1) { developerModeActive = true; } + else { developerModeActive = false; } + } + + if (developerModeActive) { + this.gameObject.transform.GetChild (0).gameObject.SetActive (true); + } else { + this.gameObject.transform.GetChild (0).gameObject.SetActive (false); + } + } + + + void OnEnable() { + Application.logMessageReceived += HandleLog; + } + void OnDisable() { + Application.logMessageReceived -= HandleLog; + } + public void HandleLog(string logString, string stackTrace, LogType type) { + string backLog = lblConsoleLog.text; + lblConsoleLog.text = logString + "\n" + backLog; + } + +} |