Simple issue - change widget text

I simply want to change the two pieces of text on the function, the issue is not the contents of the text variable as ive debugged it.


error message:

Is it a child widget of another WBP? If so - I did see recentry a similar problem on 5.3, where child widget suddenly get lost their pointers to parent objects . Don’t know the reason, but we’ve found two possible solutions:

  1. recreate this child from scratch… just because we’ve found that it can work in similar scenario in another widget nearby. That’s the way we’ve chosen
  2. “recover pointers manually”. The idea is that this(self) pointer in graph should be valid. From there you may manually do something along the lines:
TextPtr1 = this->GetChildInSlot(0)->Cast<Canvas>->GetChildInSlot(0)->Cast<Overlay>->GetChildInSlot(1)->Cast<Grid>->GetChildInSlot(0)->Cast<Text>

At very least it can be used to verify the problem\make sure that those widgets are really exist, just lost. Wouldn’t really recommend it as a solution, since it’s literally hardcoding widget structure, which will be quire hard to modify further. Nevertheless - is possible

Nope none of the widgets involved are children

Where do you call this function from?

Have you tried removing both text components and re-adding them back in? I don’t mean copy (then delete) and paste back in, I mean delete (compile) and add a fresh ones, rename them to what you need, tick isVariable in details and compile.

Very strange error indeed, as they are both visible on the list of components on the left hand side (meaning they are variables).
For some reason engine thinks they are not there.
I take it compiling everything and restarting the editor did not help.

Have you tried re-creating this widget or at least this part?

Does this also happen if you make a fresh function?

Try naming function and both text variable something else (unique).

Maybe there is some “bad” stuff sitting in memory, try rebooting as last resort.

Funny enough this works, i tried remaking the text varibles, running it through a custom event, putting the variables different places and still they are not recognised

Can you explain exactly what you’re doing from start to end step by step? It doesn’t make sense for it not to work.

So basically when the player picks up and item it spawns a new “item slot” button widget. when hovering over the widget this is the code:

That then links to the main inventory widget where i want the text to display and i get this error message:

If i try to run this code with a custom event or custom function i get the same error. However if i use any other random event from the main widget it sets the text fine:


IchorPreviewNetMode_Standalone064-bit_PCD3DSM62025-04-2117-26-11-Trim-ezgif.com-video-to-gif-converter

Brilliant! Thank you. Now it’s more clear.

I believe your problem is that you don’t have a valid reference to your Inventory Grid.
It’s your NewVar from the first screenshot. You need to pass over this reference when you first create this slot in order for this to work. You can expose it like you did with other variables. Depending on how you handle your pickup (eg. linetrace / overlap) you should have access to your player character which in turn should have a variable that is a reference to your WBP_Inventory_Grid. You would create this reference when you create your WBP_InventoryGrid widget for the first time.

Sorry for taking a while to respond. I had some technical issues.

I cast through the player to get the inventory reference and it worked! Thankyou so much for the help legend

Great. Happy to hear you were able to resolve this. :clap:

1 Like