Hello!
I’m in school for game development and a new UE4 user. I have a very basic looking third person target practice game. I have a number of targets spread out across a landscape and when they’re shot, they are removed from view. I also have a HUD counter that counts each target when they’re hit and the counter works, but the number doesn’t replace the original value of 0. It just puts it on top. I will put screenshots to illustrate what I mean.
Here is the counter before anything is hit:
Here is the counter after the first target is hit:
As you can see, the 0 is still shown even after the 1 appears and they’re just stacked on top of each other.
I also have a couple blueprint images of the game mode, the target, and HUD.
I firmly believe I may have not included a node, or not done a blueprint correctly in the “UpdateHUDwithTargetsHit” block in the Game Mode blueprint, but I’m not sure what I did wrong. Any help will be appreciated!
From the first screenshots, I’d guess you are somehow instantiating 2 versions of the HUD, and only updating one of them. Could you try to disconnect the logic from your gamemode begin play function, and see if a HUD still appears?
Tried that. It did show the HUD without the beginplay node connected, but it wasn’t counting anything. So I think there’s another beginplay setup somewhere else.
Hey, you don’t need to cast in your HUD and for your target it should be enough to cast once at BeginPlay. You could try this (only used the shown Events):
W_HUD:
Ok…Just did all of the changes you suggested and it’s still not working properly. It’s also counting the same target multiple times (probably because the target was supposed to move out of view once it’s hit…I had it set to go below the terrain before I changed to your suggestion.)
So I just opened your file and it works. I looked at all the blueprints and they’re exactly the same as mine, so I don’t know why it’s behaving differently in my file. I would share it with you, but my content folder is over 10 GB and I don’t want you to have to download something that large for this.
like it counts the same target I’m hitting for as many times as it’s being hit. when I playtested it after changing the blueprints, I hit the first target 36 times.
Did you change anything else? Is it really the same, like how do you get your text? Or did you copy my solution? Is there a function in your projectile which could cause this?
I didn’t change anything. The only thing I can think of is that my game is in third person mode, not first person like your setup. I can’t imagine that would make any difference, but even when I copy and pasted your nodes, I had to change your first person game mode refs to third person.
Are you using EventTick in Blueprints which are affecting your targets/character/gamemode? Is there something odd? How does your projectile look like? If you want me to have a closer look or test just those blueprints for your targets for yourself, you can migrate your blueprints to a new empty project. To copy/pack a project, click on File-PackageProject-ZipUpProject