How can I make a HUD collectible item counter? Can print to screen, but not to HUD.
I managed to make the game count the items collected (here I call them Life) and print the number to screen. However, I want to have it add the number to a HUD.
this is what I have in the Life actor blueprint (the adding function) https://i.gyazo.com/66f1e3beeb9c4511757402043b7a4e35.png
this is what's on the pawn character blueprint https://i.gyazo.com/899d73ab34674f90af9fa2bbf91636ae.png
this is the event graph for the HUD https://i.gyazo.com/87da83f40f69dccfea0dcb35387bb20d.png
and something I tried to do to get it to read the variable and bind it to an empty text box on the HUD (it doesn't work) https://i.gyazo.com/d12e1a96fdc9f2ce6db05b9b4005c185.png
Any help is really appreciated! I'm pretty new to this and can't figure it out. Thanks! welp
PS. If you know how to stop the counter from resetting every time I leave the level, and come back in, please share as well, it would really help.
It would probably be more efficient to handle the variable stuff in the pawn's BP.
As far as printing to your HUD goes, change the binding to a new variable (i.e. Life) in the widget, and during the tick even cast to the pawn and set the widget's Life variable to the pawn's variable. I've personally only ever had problems with binding functions on widgets.
answered May 13 '17 at 03:45 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here