Can't get the text to show up in HUD

I’m not sure what I’m doing wrong here. I thought I had this challenge nailed (and from the solution it looks like I did), but I can’t get my HUD to show the score.

I made sure the game mode is using BP_HUD.

My BP_HUD looks like this:

I checked with print that my score increments properly.

My binding for the text in my scoring widget is the same as Sam’s:

Anyone have any ideas why my text isn’t showing up in my HUD? Not even the 0 is showing up, which makes me think that the BP_HUD isn’t being called properly.

Okay, so I’ve figured out that the HUD is working properly. In two lectures, we add player health to the HUD and this works fine for me. So I guess the problem lies with the text being unable to access the score from the game mode. I’m using a getter method like Sam does in the lecture.

As I said already, my score increments properly, as it was printing like Sam’s was in the previous lecture when we tested it. I tried making score public and getting it directly through the widget function but it didn’t work. I’m not sure what I’m missing here.

I had the same problem. If you haven’t fixed it yet, it is pretty simple. In the Score Widget constructor, cast to the infinite game mode. Promote the cast value to a variable, then replace the cast in your GetScore function with the variable.

image

Privacy & Terms