Need Help Casting Variable For UMG Text Bind

Hello. I’m figuring out Casting for the first time and not doing something right.

When my game ends a timer stops and I’m setting variable FinalTime inside of BP FinishTriggerBox.

On my EndScreen Widget I put down a text box, hit bind, and made this:

The only thing that happens is Cast Failed and I can see the PrintScreen. I’m guessing it has something to do with the open Object pin but I really don’t understand how this works.

Suggestions?

Try draging out the “Object” pin and typing “self” in the search box for “Get reference to self”. Here is some information on casting. https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/CastNodes/index.html

Thanks for responding so quickly. I tried Self and no dice, still get Failed To Cast.

This is the BP I’m trying to Cast To:

Pretty sure I did that timer thing the hardest way possible…but it’s late.

Ah, I see what you are doing now. Well, you’re kind of doing it backwards. You are using a getter function on your widget when you need a setter (that or just go right to the widget from your actor without a function at all. You can turn the textbox into a variable with the checkbox on the top right when it is selected.)

32392-widget_designer.jpg

Disclaimer: I did not test this, I have barely touched UMG, so if it is all wrong, I’m sorry, just a theory.

I’ll give it a shot tonight and report back. Thanks for your help.

I went the route of making Text a variable and setting it directly. Thank you so much for your help, with two minor tweaks to what you had above it’s working:

http://i.imgur.com/gdvbUVg.png

For some reason doing Set Text Block 240 and then pulling off of it to Set Text (Text) wouldn’t do anything. It just said “Text Block” on the menu screen because that’s the default value. I killed Set Text Block 240 and connect the Cast directly to Set Text (Text). When I did this, the Blueprint system added the Text Block 240 target in between. I straight up have no idea how it knew to do this, or what would have happened if I had two variables existing in EndScreen.

You said you don’t use UMG much, but you must add “Add To Viewport” for the menu to actually appear on-screen after the Create Widget.

Glad it helped! I was a bit puzzled by the way it pulled out the setter pins, wasn’t sure what that was about but that clears it up!