public override void OnUpdate()
            {
                WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide();

                if (localSide == null)
                {
                    return;
                }
                ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element;

                if (Window_InGameBuildTabMenu.Instance.EntityChangedSinceLastButtonSetUpdate_QueueControls)
                {
                    elementAsType.ClearButtons();

                    GameEntity entity = World_AIW2.Instance.GetEntityByID(Window_InGameBuildTabMenu.Instance.EntityID);
                    if (entity != null)
                    {
                        //float aspectRatioAdjustedButtonWidth = elementAsType.ButtonWidth;
                        //float aspectRatioAdjustedButtonHeight = elementAsType.ButtonHeight;
                        //if ( ArcenUI.Instance.PixelsPerPercent_X != ArcenUI.Instance.PixelsPerPercent_Y )
                        //    aspectRatioAdjustedButtonWidth *= ArcenUI.Instance.PixelsPerPercent_Y / ArcenUI.Instance.PixelsPerPercent_X;

                        float runningY = 0;
                        {
                            bTogglePause newButtonController = new bTogglePause();
                            Vector2      offset;
                            offset.x = 0;
                            offset.y = 0;
                            Vector2 size;
                            size.x = elementAsType.ButtonWidth;
                            size.y = elementAsType.ButtonHeight;
                            elementAsType.AddButton(newButtonController, size, offset);
                            runningY += size.y;
                        }
                        {
                            bToggleLoop newButtonController = new bToggleLoop();
                            Vector2     offset;
                            offset.x = 0;
                            offset.y = runningY;
                            Vector2 size;
                            size.x = elementAsType.ButtonWidth;
                            size.y = elementAsType.ButtonHeight;
                            elementAsType.AddButton(newButtonController, size, offset);
                            runningY += size.y;
                        }

                        elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared();

                        Window_InGameBuildTabMenu.Instance.EntityChangedSinceLastButtonSetUpdate_QueueControls = false;
                        Window_InGameBuildTabMenu.Instance.MenuIndexChangedSinceLastButtonSetUpdate            = true;
                    }
                }
            }
            public override void OnUpdate()
            {
                WorldSide localSide = World_AIW2.Instance.GetLocalSide();

                if (localSide == null)
                {
                    return;
                }
                ArcenUI_ButtonSet      elementAsType    = (ArcenUI_ButtonSet)Element;
                Window_InGameBuildMenu windowController = (Window_InGameBuildMenu)Element.Window.Controller;

                if (windowController.EntityChangedSinceLastButtonSetUpdate_Queue)
                {
                    elementAsType.ClearButtons();

                    GameEntity entity = World_AIW2.Instance.GetEntityByID(windowController.EntityID);
                    if (entity != null)
                    {
                        float runningX = 0;
                        {
                            bTogglePause newButtonController = new bTogglePause();
                            Vector2      offset;
                            offset.x = runningX;
                            offset.y = 0;
                            Vector2 size;
                            size.x = elementAsType.ButtonWidth / 2;
                            size.y = elementAsType.ButtonHeight;
                            elementAsType.AddButton(newButtonController, size, offset);
                            runningX += size.x;
                        }
                        {
                            bToggleLoop newButtonController = new bToggleLoop();
                            Vector2     offset;
                            offset.x = runningX;
                            offset.y = 0;
                            Vector2 size;
                            size.x = elementAsType.ButtonWidth / 2;
                            size.y = elementAsType.ButtonHeight;
                            elementAsType.AddButton(newButtonController, size, offset);
                            runningX += size.x;
                        }
                        if (entity.BuildQueue != null)
                        {
                            List <BuildQueueItem> items = entity.BuildQueue.Items;
                            for (int x = 0; x < items.Count; x++)
                            {
                                BuildQueueItem item = items[x];
                                bQueueItem     newButtonController = new bQueueItem(entity.TypeData, item, x);
                                Vector2        offset;
                                offset.x = runningX;
                                offset.y = 0;
                                Vector2 size;
                                size.x = elementAsType.ButtonWidth;
                                size.y = elementAsType.ButtonHeight;
                                elementAsType.AddButton(newButtonController, size, offset);
                                runningX += size.x;
                            }
                        }
                    }

                    elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared();

                    windowController.EntityChangedSinceLastButtonSetUpdate_Queue = false;
                    windowController.MenuIndexChangedSinceLastButtonSetUpdate    = true;
                }
            }