Download

RTS style selection box difficulties

Hello,

I am having a bit of difficulty creating RTS style selection rectangle. It’s mainly UE4 HUD system that is giving me a hard time. There seems to be tons of limitations, but I just can not understand why they are in place:

1, I can not call any input events, such as axis and action inputs from HUD class blueprints, so I can’t handle it all inside HUD blueprint.
2, I can not use any “Draw” functions in any other blueprint class than HUD class, yet for some reason, these functions are not filtered out in any other blueprints, which somewhat implies they should be usable even outside of HUD class, but when I try to, I get: “Canvas Draw functions may only be called during the handling of the DrawHUD event” error. So I can’t handle it all inside Player Controller blueprint.

Following these limitations, I have somewhat working selection rectangle, where I have this part in my player controller:


and this part in my HUD class:

But it feels very sub-optimal, having to have something so simple scattered between two different blueprint classes. In Unity, I was able to draw to HUD from any script, so I can’t wrap my head around why I would not be able to do so in UE4. Or did I misunderstand those limitations? Is there any way to do it inside single blueprint?