How do you set a widget to visible from another actor?

Let’s say we have a button in the form of a blueprint. When clicking that button a text should become visible on a screen that is a different actor from the button. How do I set the widget to visible in the button’s event graph?

• you’d need to know the purpose of this to set this up correctly as there are too many ways. But we need to know more.
• what is the actual scenario?
• is this really a one-time thing?
• most importantly, how, where and when are those blueprints instantiated?

Communication is cirumstantial. You need to tell the editor where things are.

The scenario is that the player(in VR, but I’m testing it in First person because I don’t have the headset at home) will pick up a letter. After picking up the letter a heading on a poster will change to something else. What I need to know is not just the method in theory. I need something I can work with, like which nodes to use and how to get a reference to the widget if that’s needed.

I’ve tried this method but I have no idea what should go in the object type.

Edit: I forgot to set the visibility in that screenshot, but doesn’t matter now.

But we still do not know much.

After picking up the letter

Where is the letter, what is it? An actor in the scene?

a heading on a poster will change

Is the heading a text in a widget? Is this the widget you’re looking for?


Do note that we know absolutely nothing about what you’re doing. Explain it like I was 5 if necessary. It sometimes is.

Are you kidding me? Anyway, I have an ACTOR BLUEPRINT in THE SCENE. When clicking that actor with the left mouse button(the type of interaction doesn’t really matter since it will be changed later) I want a widget in ANOTHER ACTOR BLUEPRINT to become visible.

It doesn’t matter where the actor is, but in this case let’s say the first actor is a note that is just lying on the ground and the other actor is a poster on a wall(A blueprint with a plane and a wigdet with text in it). I can’t be more precise than that, except:

[Actor] → on click → [Actor[widget → set visible]]

It does matter oh so much! If the actor was spawned dynamically or was in another level or it was multiplayer, or there were 10 letters or a dozen other scenarios I can think of, I’d treat each differently (slight dramatisation).


To clarify:

  • a wall actor with a poster widget component inside is in the scene
  • a letter actor with a clickable mesh is also in the scene
  • we click on the mesh, text in the poster widget component’s widget changes

How close am I? I am really trying to help, hence the questions. I need to know what needs doing.

You’re getting there, lol. But the wall actor is a poster blueprint with a widget attached. That widget needs to be changed to another widget. Would it be easier to add the widgets separately instead of having it inside the poster blueprint?

Would it be easier

Does not matter. We just need to know where actors are, how they’re spawned, when and by whom. If they’re both sitting pretty in the level, it’s rather trivial to set up. But we need to know that. Are both actors in the scene or not?

That widget needs to be changed to another widget.

Hm? You’re swapping widgets around?

Method 1

  • actor with a widget:

  • in the Level Blueprints:

image


Method 2

  • have a poster reference in the button BP:

  • tell the button which poster you mean:


These are the two most straightforward methods. There’s more. How to handle it will depend on the circumstances.

1 Like

Ah, that’s a very smart approach. I didn’t think of the the level blueprints at all. Gonna give this a go tomorrow. Thank a bunch!

Both actors are in the scene. If they weren’t, where else would they be?

Spawned dynamically. In another level. Instantiated by a child actor component, which is, kind of, dynamic but with extra steps.

No game has all the stuff present upfront. You make and destroy entities on the go. Do note that you can make en entire game without ever touching level blueprint. Think procedural games where stuff spawns based on some conditions.

Maybe your game has randomised rooms, with randomised puzzles. Sometimes there is a puzzle to solve, sometimes you take an arrow to the knee.

Alright. I noticed something I don’t understand though. What is wMyWidget in the first method? Can’t see where that’s coming from.

You mentioned a poster actor with a widget component.

a text should become visible on a screen that is a different actor from the button

Okay, now I see.

There is one thing I don’t get in the first example, when trying to replicate this. The last node from the left “SetText” is a function. What did you do there?

Flag a text block as variable:

image

You can then:

image


This equals to:

  1. get a widget component
  2. get the widget that the component instantiated
  3. cast to convert to the type we need
  4. get the text block from the widget
  5. set the text block’s text value

Okay, but I can’t connect the pink pins. The pin of the custom event is blue and not the same type.

It’s a custom event, you add the pins and you choose the type. Choose Text.

image

That’s one way of moving data around.

Nice. I didn’t notice that. But you learn something everyday. ^^