1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Popup won't open via UIManager:QueuePopup

Discussion in 'Mod Creation Help' started by Infixo, Mar 1, 2018.

  1. Infixo

    Infixo Warlord

    Joined:
    Jan 9, 2016
    Messages:
    2,269
    Gender:
    Male
    Location:
    Warsaw
    I am trying to open UnitPromotionPopup using LuaEvents.UnitPanel_PromoteUnit(). Very simple event that ends up calling OnPromoteUnitPopup() in UPP.lua that prepares data and eventually calls UIManager:QueuePopup(ContextPtr, PopupPriority.Current) to open a window.

    You can fire the event in FireTuner and it always goes into OnPromoteUnitPopup(). If the unit has an available promotion, it properly queues the popup. I've checked that using UIManager:IsInPopupQueue(ContextPtr).

    Now the problem. The window only opens if the unit is already selected on the map. And I want to do the following:
    Code:
    UI.SelectUnit(Players[0]:GetUnits():FindID(xxx))
    LuaEvents.UnitPanel_PromoteUnit()
    
    xxx is ofc a unit id, but a different one. The selection works - another unit is selected (checked with UI.GetHeadSelectedUnit()), event is called, OnPromoteUnitPopup() properly detects selcted unitt (yes! it knows that a new unit is selcted), popup is queued (again, checked that) but the window doesn't open. What gives? What am I missing in this sequence?
     

Share This Page