In the event graph I just drag out the Widget component but I can’t access this custom event at all (I even tried casting to its class in desperation). None of the widget variables are accessible either which might’ve been more expected.
How should I do this?
My only solution that I can think of is to create one 3d widget component for each element I’d like to hide/show and switch between, in my case, 4 different components. Not quite as nice as using custom events (or whatever I should be using).
I think this is still experimental so maybe this isn’t done yet but it’d be great to hear either way.
It’s an actor BP which has a 3d widget component, so basically I just went into my actor’s viewport and added a ‘widget’ component there, and set it to my 3d widget class. Then my widget component shows up as a variable in the BP which I’m trying to use to fire off a custom event (which was created in the 3d widget’s graph).
I might’ve not been very clear I realize, basically all I’m interested in is if I can access a 3d widget’s custom events if that 3d widget is a ‘widget’ component of an actor.
If not it’d be great to hear if there’s another way, and if there’s no way at all that’d be very good to know as well. Thanks!
Yup, my variables are set like that, although I’m actually trying to get to the custom event (which in turn is accessing the variables)… but I was looking for that as well, and I could just take the custom event out of the widget into the actor BP instead.
So when you say I should reference the widget, not the widget through the character (my widget is a component of an actor BP btw, not a character class BP which probably doesn’t matter), what exactly do you mean? I’m just dragging out the ‘widget’ variable - which appears once the 3d widget component is created - and trying to get the custom event/variables from that. So I’m not using the actor BP to get to the widget as I’m already inside the actor BP.
Ok but that way you’re constructing a widget on the fly, I have mine pre-made and can’t for the life of me access its functions and variables. Here’s a pic of what I’m trying to do:
So my widget is there already, I’ve tried grabbing the widget ref right away and also getting it as a child component but neither will allow me to fire a custom event or access variables.
Maybe it’s not supported? I could probably do what you’re suggesting but I’d still prefer to do it without constructing it on the fly. Plus now I’m really interested in hearing if it’s possible at all as well.
The way I do it is instead of creating custom events inside the widget I create variables elsewhere (like in the GameMode blueprint or in the Controller blueprint). Then I access this variables using Event Tick inside the widget (with GetPlayerController and casting to my custom controller for example or with GetGameMode and casting to my custom GameMode blueprint, usually through a function for convenience). So when I want something to happen -like start or stop an animation- I just change the variables and the widget will do the rest on its own.
You can also set visibility of 3D widgets inside the blueprint actor as with any regular component.
That’s pretty neat actually, although I try to stay away from as many Event Ticks as possible but what you’re doing doesn’t sound like it’d take up many cycles.
Setting vis of the entire widget wouldn’t work very well for me in this case (would’ve worked, but now I’m just creating billboards instead and have ok control that way) but I’ll keep that in mind!
Yes. I haven’t seen any performance issues with Event Ticks inside widgets, at least in this case, so I’m OK with it for now. Of course, in the future it would be nice to have access to 3D widget events as when you use them on the Viewport.
Another possibility could be to use the events in the details panel of the 3D widget, though I haven’t tried it yet.