private IEnumerator InitConsole() { const string _eventSystemName = "EventSystem"; GameObject eventSystem = GameObject.Find(_eventSystemName); GameObject console = Instantiate(gameConsole.gameObject); console.name = gameConsole.gameObject.name; ConsoleGUI guiConsole = console.GetComponent <ConsoleGUI>(); guiConsole.init(swipeOptions, startMinified, limitOfLogs, defaultMailDirectory); guiConsole.ToggleActions(); if (Screen.width > Screen.height) { CanvasScaler scaler = console.GetComponent <CanvasScaler>(); scaler.referenceResolution = new Vector2(1800, 600); } DontDestroyOnLoad(console); yield return(new WaitForEndOfFrame()); guiConsole.SwitchConsole(); guiConsole.ToggleActions(); if (eventSystem == null) { GameObject _eventSystem = new GameObject(_eventSystemName); _eventSystem.AddComponent <EventSystem>(); _eventSystem.AddComponent <StandaloneInputModule>(); _eventSystem.transform.position = Vector3.zero; DontDestroyOnLoad(_eventSystem); } GameConsole.AddAction(guiConsole.MinifiedConsole, "Show minified console", startMinified); guiConsole.popup.gameObject.SetActive(startMinified); Destroy(gameObject); }
public void init(ConsoleGUI cGui) { _gui = cGui; Application.logMessageReceived += HandleLog; }