HUD. Is there a way to redraw something on the screen only sometimes?

Hi,

No, there is no way to avoid it. It’s how rendering works. Screen being cleared every time to draw another data to the screen, since it’s being updated every frame. If you do not draw something - it’s not being drawn, sounds easy enough :slight_smile:

If you perform some calculations before drawing the health bar, you would be able to optimize it by calculating only when required, for example, when your actor is being hit by something and loses health, but you MUST draw your health bar every frame.

Hello.

I’m creating HUD in game using c++ and canvas. I’ve done almost everything, that I wanted but it’s done a bit wrong, I think, because whole HUD is being redraw each frame. I’d like to avoid it.

Let’s say, I have a health bar that should be drawn to the screen. What I want to do is, to draw it once, and I want it to stay on the screen until health value is changed in player. When it is, I want to redraw health bar again.

Unfortunately, this bar only appears only if I draw it to the screen. So I can’t draw it (for example) once per 10 frames. It seems like AHUD clears screen before DrawHUD is called. Is there a way to avoid it?

Drawing on the HUD is a very low cost operation in terms of computing, so you do not need to worry about that. Just store the health information in your HUD blueprint as a variable and update it only when it changes via a blueprint interface.