/// <summary>
        /// Initializes the User Interface Manager.
        /// </summary>
        /// <param name="autoUpdate">Auto update and render.</param>
        public static void Initialize(bool autoUpdate = true)
        {
            if (initialized)
                return;
            try
            {
                Visible = true;
                InputEnabled = true;
                initialized = true;
                // Set some public parameters.
                TextureResizeIncrement = 32;
                ToolTipDelay = 500;
                AutoUnfocus = true;
                ToolTipsEnabled = true;
            
                #if (WINDOWS)
                    MenuDelay = SystemInformation.MenuShowDelay;
                    DoubleClickTime = SystemInformation.DoubleClickTime;
                    window = (Form)System.Windows.Forms.Control.FromHandle(EngineManager.GameWindow.Handle);
                    window.FormClosing += FormClosing;
                #endif

                RootControls  = new ControlsList();
                OrderList = new ControlsList();

                EngineManager.DeviceReset += OnDeviceReset;

                states.Buttons = new Control[32];
                states.Click = -1;
                states.Over = null;

                // Input events
                InputSystem = new Input();
                InputSystem.MouseDown  += MouseDownProcess;
                InputSystem.MouseUp    += MouseUpProcess;
                InputSystem.MousePress += MousePressProcess;
                InputSystem.MouseMove  += MouseMoveProcess;
                InputSystem.KeyDown    += KeyDownProcess;
                InputSystem.KeyUp      += KeyUpProcess;
                InputSystem.KeyPress   += KeyPressProcess;

                // Final render target.
                AssetContentManager userContentManager = AssetContentManager.CurrentContentManager;
                UserInterfaceContentManager = new AssetContentManager { Name = "User Interface Content Manager", Hidden = true };
                AssetContentManager.CurrentContentManager = UserInterfaceContentManager;
                renderTarget = new RenderTarget(Helpers.Size.FullScreen, SurfaceFormat.Color, false, RenderTarget.AntialiasingType.NoAntialiasing)
                {
                    Name = "User Interface Render Target",
                };
                AssetContentManager.CurrentContentManager = userContentManager;

                // Init User Interface Renderer.
                Renderer.Initialize();

                // Set Default skin.
                SetSkin("Default");

                // Window resize.
                oldScreenWidth = Screen.Width;
                oldScreenHeight = Screen.Height;
                Screen.ScreenSizeChanged += OnScreenSizeChanged;

                EngineManager.DeviceDisposed += delegate
                {
                    Renderer.Initialize();
                    // Invalidate all controls.
                    OnDeviceReset(null, new EventArgs());
                    SetSkin(Skin.CurrentSkinName);
                };

                if (autoUpdate)
                {
                    // To automatically update and render.
                    userInterfaceGameObject = new GameObject2D();
                    userInterfaceGameObject.AddComponent<ScripUserInterface>();
                }
            }
            catch (Exception e)
            {
                throw new InvalidOperationException("User Interface Manager: Error occurred during initialization. Was the engine started?", e);
            }
        } // Initialize