I tried using a custom event and a “cast to” but there wasn’t a place to connect the float variable to. How do I do this? Thanks.
How do I get my character blueprint and my hud blueprint to read values from the same float variable?
Thanks man. The variable only changes once a second. The float value is how much battery life my flashlight has and I want to take that float value that’s already being calculated in my character blueprint and pump it into my HUD for material display purposes. I have everything set up so far except the variable.
I would be using a blueprint interface. Can you be more specific? How often does the variable need to be read? If you aren’t sure about how to use blueprint interfaces i can explain it if you would like but i will need more info.
Ok first thing to do is to create the blueprint interface. Go to a folder that you want the interface in. I just made mine in the blueprints folder. Right click > Blueprints > Blueprint Interface. Create a function in the interface. I called mine battery life update. create an input float variable. Save and close the interface. Open your character blueprint and add the node (what ever you named the function in the interface) to your network. Make sure you clicked the node under INTERFACE MESSAGES (not call function). That part is important. It needs to be called everytime you want the HUD to update the variable. Connect a getter of the battery life variable to the node. Save and Compile. Open your HUD. At the top click blueprint props, scroll to the bottom of the details pane, click the add button under implemented interfaces. Select the Interface you created. Now add the same node that you did in your character blueprint except its the add event one not the Interface Messages. Now i created a float variable in the hud and named it battery life and set the value from the event node to the new variable. Now you have your float variable being sent from your character blueprint to your hud. Hopefully the screen caps cover anything i left out
Thanks for taking time out to help me with this. I’m trying to create what you are showing me but for now it’s not working. Here’s some screens to show what I have. Also I’m not sure what’s supposed to actually tell my custom event “BatteryLifeUpdater” what it’s doing. I also don’t get this compilation error I’m getting. I got the first reference from interface messages like you said, and then the other from add event like you mentioned. But now there’s some strange naming issue.
That error seemed like a UE4 error and not user error. It crashed the editor and I had to go back to a previous version just to open it again.