I am trying to cast to MyCharacter from my HUD
I am trying to cast to MyCharacter in order to retrieve the gamescore variable for my game from my HUD blueprint. I have the following so far (see attached picture)
So basically I am getting the printed string Score to HUD failed. I think this is related to the object in cast to Mycharacter. I do not know what to give it.
Could someone give me some insight on this? It'd be very appreciated.
asked Oct 30 '14 at 09:06 PM in Blueprint Scripting
You need to cast the score variable from your MyCharacter BP to your HUD. That way, your MyCharacter BP does all the math, and your HUD just displays it. There isn't any need to cast from the HUD. I did a quick mockup below.
The Level Blueprint adds 1 to the variable ScoreVar each time I press the F key. It then Casts that result to the HUD. The HUD Blueprint then draws the score to the bottom right of the screen. Everytime I hit the F key, it updates. Does this help?
answered Oct 30 '14 at 10:10 PM
Try deleting that draw text hud, then right clicking anywhere in the HUD BP and pull up a new Draw Text. I'm not sure how, but that Draw Text Node you are using is targeting the Canvas and not your HUD. Notice your Draw Texture node says Draw Texture and Target HUD beneath that, it should be the same for your Draw Text.
answered Oct 30 '14 at 11:46 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here