Event priority and consume input

I am writing a game where all the player input will be trapped in the HUD blueprint, and depending on the game state the code will branch to handlers within the various other blueprints, if necessary. However, an awkward situation has arisen.

For the elements displayed in the HUD itself I create hitboxes, and then based on the name of the hitbox do something when clicked. This I believe is standard practice. In the AddHitBox I have checked “Consumes Input” and each hitbox is given a priority based upon its “z-order” (the order in which they are drawn on the screen) so that objects that overlap others get priority. This works as advertised - clicking on an area where several elements overlap results in the EventReceiveHitboxRelease firing only for the topmost hitbox.

Of course, the player isn’t necessarily only going to click on these HUD elements, as there are objects with which he may interact in the world; the game is a perspective view RTS, so he may select his units and give them orders such as moving and attacking via mouse clicks. I don’t want to have to raise level events from every object in the game, because I don’t feel it is necessary to duplicate the click handler in the level blueprint for every map the player wishes to play and most of these objects will be spawned in real time anyway. So instead I hook the “Left Mouse Button” event in the HUD blueprint. The idea here is that if the player clicks a hitbox the input is consumed, and therefore the LMB event will not trigger, so if the LMB event triggers then the player has clicked on something in the world and I can work out what with a simple trace, and based on what actions he has performed previously determine what he is trying to do. I also checked “consumes input” here just because I can.

However the LMB event ALWAYS triggers, regardless of whether a hitbox is clicked or not. In fact, if I click a hitbox BOTH events trigger - which is to say neither event consumes the input. Since I can’t set the priority on the LMB event (that I can see), how can I get around this problem without making some kind of workaround involving flags to indicate that the event has just been handled? Please note that in both cases I monitor the “released” event trigger, as opposed to one happening on mouse button down and the other on mouse button up.

I have tried trapping the LMB event in the PlayerController blueprint, anticipating it having a different priority to click events generated in the HUD blueprint, to no avail. It would seem that “consumes input” therefore only consumes the specific event for which it triggers rather than something general like leftmousebutton preventing all other click events from triggering. Is this true?

So the workaround is to set a flag when “Event Receive HitBox Begin Cursor Over” (and clearing said flag on cursor out). Then when LMB pressed triggers, test first whether the mouse cursor is over a HUD element by testing the flag, and if not only then continue with checking for objects in the world being clicked. Of course if, like most game engines, cursor out fails to trigger correctly on occasion due to rapid movement of the mouse over several HUD elements, then clicking in the world is going to be ignored until the player moves over and out of a HUD element “correctly”, so this is not a clean solution.