Casting to widget blueprint

Hello! I am new to Unreal Engine 5, and I am trying to create a simple with a inventory as well as some other things.
As you can see below, I have made an inventory as a user widget.

My problem is I am trying to hide the different items (hammer and keys), until the player collects the different items. So therefore I have created a variable for each item. And I’m trying to cast from my FirstPersonCharacter to the user widget, so that if I have the specific item, the picture of that item will be visible. But if the player doesn’t have that item, the item will not be shown.

But when I am trying to cast to the User Widget, i have to connect something to the object. But I have no idea what to connect to it. And nothing i have tried has worked.

What should I do?

I am happy do provide more information or pictures if needed.

I do realise that there is a chance that I am doing this entirely wrong. So if that is the case, I would be happy to change what I have done.

Thanks in advance :slightly_smiling_face:

1 Like

When you construct the widget, you get a reference. You can use that directly, you probably don’t need to cast

image

1 Like

Sorry, but I don’t think i quite understand what you mean

Well, if you want to set the variable, the widget must be on the screen, right?

You can’t set the variable if the widget doesn’t exist :slight_smile:

Ahhhh I understand what you mean now! And managed to get it working. Thanks for your help!!!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.