Example #1
0
        private void Awake()
        {
            config = Resources.Load <ConsoleConfig>("ConsoleConfig");
            if (!config)
            {
                Debug.LogError("Couldn't find ConsoleWindow Config file! Make sure there's one called 'ConsoleConfig' in a resources folder.");
                gameObject.SetActive(false);
                return;
            }

            ToggleConsoleWindow(config.startOpen);
            pool.Init();
            HideLogInfo();

#if UNITY_EDITOR
            Application.logMessageReceived += Log;
#elif !UNITY_EDITOR
            if (!config.disableLogsInBuild)
            {
                Application.logMessageReceived += Log;
            }
#endif

            FindAllCommands();
            commandHistory.Insert(0, "");

            DontDestroyOnLoad(gameObject);
        }
Example #2
0
        private static void InitConsole()
        {
            ConsoleConfig config = Resources.Load <ConsoleConfig>("ConsoleConfig");

            if (!config)
            {
                Debug.LogWarning("Couldn't find ConsoleWindow Config file! Make sure there's one called 'ConsoleConfig' in a resources folder.");
                return;
            }

            if (!config.autoInitConsoleOnStartGame)
            {
                return;
            }

            // Only execute if there's no consolewindow yet.
            if (!Object.FindObjectOfType <ConsoleWindow>())
            {
                // Find consolewindow in resources.
                GameObject consoleGO = Resources.Load <GameObject>("ConsoleWindow");
                if (consoleGO)
                {
                    // Instantiate consolewindow object and hide in hierarchy.
                    GameObject newConsoleWindow = Object.Instantiate(consoleGO, Vector3.zero, Quaternion.identity);
                    newConsoleWindow.hideFlags = HideFlags.HideInHierarchy;
                }
                else
                {
                    Debug.LogWarning("Couldn't find a ConsoleWindow GameOject in Resources.");
                }
            }
        }
Example #3
0
        private static void HighlightConfig()
        {
            ConsoleConfig config = Resources.Load <ConsoleConfig>("ConsoleConfig");

            if (!config)
            {
                Debug.LogWarning("Couldn't find ConsoleWindow Config file! Make sure there's one called 'ConsoleConfig' in a resources folder.");
                return;
            }

            Selection.SetActiveObjectWithContext(config, config);
        }