getting variable data from widget in another blue print?

I set up a widget for timer, which works as HUD.

How do I pass this time variable from HUD to another Blueprint? Note: variable already made public.

also, variables being calculated from tic, I’ve read you should try to limit tic calculations. about 4 different variables to call
Time, Time2, Variable 3, Variable 4

new here, and a picture of event graph and how to do it might help…

You need to know where the HUD widget is, where another Blueprint is and what it is. How are they added to the game? What is another Blueprint?

also, variables being calculated from tic, I’ve read you should try to limit tic calculations. about 4 different variables to call

True-ish, Tick is rightly demonised but often for wrong reasons. It’s more like: “Do you need the value every single frame of the game or not?” If you do, you do. You can update player’s health once - when they hit / heal, rather than non-stop, 120 times per second.


Also, tying calculations to framerate may not be great for a lot of other reasons. All off a sudden that one chap with 9800X3d regenerates health 4x faster than his mates because his CPU goes brrrr…

The only thing done that way (tic) is Time for the game. (suggested by a tutorial)

Odd. Why not use a timer - it already counts time, spits out lots of data and is frame independent. Measuring time should not be Ticking every frame by definition…

The hud widget is in a seperate folder from the blueprint (does this make a difference)

HUD is called from Game Mode , Hud Class (i believe)

Blueprint of object in Outliner. (seperate browser asset folder)

Also , don’t know how to get two blueprints to pass global variables. (if you could link me to a lesson on this topic as well) I thought once a variable is global, you should be able to call it to any bluprint, just by writing variable name…

No.

HUD is called from Game Mode , Hud Class (i believe)

Which one then? Game Mode or HUD. Could you show the script? It’s not about calling but creation - is the widget created in the HUD class?

Blueprint of object in Outliner.

How does does the actor that was created from this blueprint makes into the game. Did you drag it into the scene? Spawned it with a Spawn Actor from Class node? Something else?

can you show me an example of a regular timer? (this was i guess someone elses workaround)
I’m using it for a Music Rhythm Game if that makes a difference.

for music accuracy calculation ,
I would guess down to 0.001 second , or 0.005 second at the worst. (1ms and 5ms respectively)

and I take it to get variables from another blue print, after a bit of reading,

that’s what casting to a blueprint to get the variable is used for?

think i figured this out. you have to cast to get the global variable from another blueprint or widget. am i gonna run into issues if my timer is run off of the tick? (in the youtube i watched to do the coding, he said with this part added , you don’t have to worry about tick issues)

No.

1 Like