示例#1
0
        public static void Initialize(Dictionary <string, MethodInfo> commands = null)
        {
            if (instance)
            {
                return;
            }

            CommandDatabase.RegisterCommands(commands);

            var hostObject = new GameObject("UnityConsole");

            hostObject.hideFlags = HideFlags.HideAndDontSave;
            DontDestroyOnLoad(hostObject);

            instance       = hostObject.AddComponent <ConsoleGUI>();
            instance.style = new GUIStyle {
                normal = new GUIStyleState {
                    background = Texture2D.whiteTexture, textColor = Color.white
                },
                contentOffset = new Vector2(5, 5),
            };

            instance.guiProxy = hostObject.AddComponent <OnGUIProxy>();
            instance.guiProxy.OnGUIDelegate = instance.DrawGUI;
            instance.guiProxy.enabled       = false;
        }
示例#2
0
        public static void Initialize()
        {
            if (hostObject)
            {
                return;
            }

            CommandDatabase.RegisterCommands();

            hostObject           = new GameObject("UnityConsole");
            hostObject.hideFlags = HideFlags.HideAndDontSave;
            DontDestroyOnLoad(hostObject);
            hostObject.AddComponent <ConsoleGUI>();
        }