Download

Variables and level bp

ive created a time and date system inside of the level bp. but i want to add the text to a widget is it possible to get variables from the level bp to the widget?

Sure. Where is the widget reference? Which blueprint adds the widget to the screen?

the character bp adds the widget to the screen.

  • the player creates the widget

  • the widget updates the text block; use whatever data you need here:

image

  • level blueprint tells the player to update the widget:

Rather than having the widget try to pull the data out of the level blueprint (complicated), we push the data into the widget instead. Since you’re calculating it all in the LB already, this should work rather well.

hey, thanks for the information but the one event you have there that is called update widget where do you have that from?

image

You make it yourself. You can have a function instead. Name it with something meaningful. You actually don’t need to make a new event, you can execute the script by hooking it up to the same bunch of nodes that update the time.

It’s just convenient to have events / functions so you don’t need to copy / paste a series of nodes. Especially if you plan to reuse them in many places.


Instead of that custom Update Widget event you could plug the cast here:

Instead of the Print String since you will no longer need it. fingers crossed

Thanks. but the only problem im having now is that refrence. and that text block you just made that of a variable right?

Drag a wire from the cast return value and search for your widget. Avoid plopping nodes down on their own. Blueprints are context sensitive:

This way you filter for what makes sense in this context rather than having to dig through thousands of options.

the text block needs a target and the widget variable does not work

Do this in the widget:

image

Note:

Your widget is not called Date/time:

You called it like this - that’s what you want to access from the third person.

yeah my bad. thanks for taking ur time with a noob xD. got it to work now. and btw what is the diffrence between a even and a function
Imgur

1 Like

Custom Events:

  • cannot return values
  • can use latent actions

Note the clock icon in the upper right.

Functions:

  • return values

  • must complete all code first, no latent actions
  • can be pure

image

Which means you can call them without the white execution wire.

There’s more to it but these are key differences in BPs.

1 Like

Most importantly:

:wink:

1 Like