private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (scene.name == "Main") { Init(); Instance.gameObject.AddIfNeedComponent <AlwaysDayConsoleCommand>(); Instance.gameObject.AddIfNeedComponent <NoInfectConsoleCommand>(); Instance.gameObject.AddIfNeedComponent <OverPowerConsoleCommand>(); } else if (scene.name == "StartScreen") { //DisplayManager.OnDisplayChanged += Screen_OnDisplayChanged; if (isInfoBarEnabled) { CmInfoBar = new CM_InfoBar(); } if (isConsoleEnabled) { CmLogger = new CM_Logger(); } CmConfig.Load(); } }
public CM_Logger() { if (Instance == null) { Instance = FindObjectOfType(typeof(CM_Logger)) as CM_Logger; if (Instance == null) { GameObject cm_logger = new GameObject("CM_Logger"); Instance = cm_logger.AddComponent <CM_Logger>(); } } }
public void Awake() { #if DEBUG show = true; #endif Instance = this; DontDestroyOnLoad(this); useGUILayout = false; drawRect = SNWindow.InitWindowRect(windowRect); scrollRect = new Rect(drawRect.x, drawRect.y + 5, drawRect.width - 5, drawRect.height - 37); scrollWidth = scrollRect.width - 42; Application.logMessageReceived += HandleLog; }