Show numbers every second on screen.

Hello everyone!

I have a problem with a text that does not update the data I supply to a text in my UI Widget.

I have an actor that generates a number that number.

I have added a cast to, although I put a note that it is not necessary, but when it does not have the cast and I call that actor with a variable, I get an error that is empty … so I leave it with the cast to.

With cast to:

Without cast to:

When I put it with cast to, the text box disappears on the game screen and does not update. If I don’t put the cast to it gives me the error that it is empty and if it is shown and I don’t know why it doesn’t update, I pass you images of the code.

Text code with cast to:

Actor code:

Code of the Actor that generates the numbers:

I wait for your answer.

Thank you very much.

1 Like

Hey @BaBuuuuuu

According to your screenshots, you never set the variable Planet inside your Widget, so it’s Null. The cast works cause even if it’s null the class is the same.

After Create UI Widget, before adding it to Viewport, set its Planet variable to Self.

Hello @GRIM_Warlock !

You mean in the UI Blueprint? Yes, I have it assigned. Maybe that’s not what you mean:

The last paragraph I don’t know what you mean. could you give me an example ? :grimacing:

Thank you very much for your quick response my friend. :green_heart:

Having the variable on the left panel is not the same as “assigning” it, that’s just an empty variable of type Planet.

You need to set its value after creating the Widget.

1 Like

Hello @GRIM_Warlock !

How did you put in the SET of Planet, another variable “Target”?

I can’t manage to do it.

Enter the planet, assigning it, but it’s still the same, it will be for “Target”.

Thank you so much :smile:

Target is UI, your widget reference. Just drag a cable from the UI variable and type “Set Planet”, the node option should appear there.

I use Self because you’re creating the widget from the Planet Blueprint, so you would be assigning the same Planet reference that’s creating the widget as the widget’s Planet variable’s value.

It works!

Thank you so much for helping me! :grin: