Drawing on same HUD from different Blueprints
I have two class blueprints called HUD1 and HUD2. Both blueprints use DrawTexture to render an image on screen.
How can I make the HUD2->DrawTexture display with the HUD1->DrawTexture ?
I know I can expose variables from HUD1 and Cast_To_HUD1_C from HUD2 but I don't really want to do that as it doesn't fit my design.
The obvious solution is to put everything into a single HUD. That is, however, a last resort as I am trying to avoid a single 'GOD HUD' blueprint that gets very big and complicated further down the line.
Create base class for your hud elements, then based on it create sub classes. In base class you create DrawElement event, where in child classes you use that event to draw element. Base class should also have varables like position and stuff like that so child classes and there object can have its own position. In hud class you add array which you keep elements spawned in object and send drawelement call in all elements in it. Think of it more like you making a framework.
answered Sep 12 '14 at 02:17 PM
I'm still not quite sure what exactly you're trying to do.
It usually makes more sense to put everything which belongs to one HUD in the same blueprint. To prevent it from becoming super big and messy you can use a lot of functions doing most of the actual drawing work.
If you want some basic functionality in several different HUDs which should display something different you can use inheritance from parten blueprints. Simply select the one you want as parent blueprint when creating a new one (instead of actor, character or whatever ;)
And last but not least if you definitely want it like this you could use interfaces. They are the second method to get variables or call functions in another blueprint besides "cast to".
answered Sep 12 '14 at 11:17 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here