Making a UI Animation play after an Event in a Different Blueprint is triggered.

I have a UI widget setup with a main image that doesn’t do anything until you press any key. Once a key is pressed a timeline runs and the menu opens. (Its a book and key press opens the book). Once the book is open I’d like a UI animation to play that would make the Play, Setting, Exit buttons appear. I’ve already built the animation to render correctly. I just can’t get the event to trigger.

Here is the image of the timeline event that would ideally trigger the animation. Its an a generic actor blue print. I’ve been reading about interfaces and was hoping that would trigger it but again i don’t know how to reference the Animation to get it push the info there using an interface.

Here is the Widget with its events. I’ve been able to bring over the interface event but i just can’t bridge these two actions.

If i have this setup completely wrong and going down the wrong path i am open to ideas.

One needs to be aware of the other. Since you have a widget, this needs to be stored somewhere that is accessible by your actor.

The simplest solution is to create a subsystem (likely derived from GameInstanceSubsystem) if you know C++. Then you can store a reference to your widget there and the subsystem is available to any code or blueprint at any time while the game is playing.

If you don’t know C++, then the easiest might be to just store an invisible Actor in the game where you add a Transient property for your widget. You can grab it using GetAllActorsByClass. So your widget would add itself to the Invisible Actor’s property. And your actor that receives the key press would grab the property when the Timeline is done (using GetAllActorsByClass).

Note that GetAllActorsByClass is a slow operation. So you may want to store a reference to the invisible actor in a property for reuse wherever you use it.

I find all games need a central repository for information sharing. I’m not sure why UE doesn’t have something a bit more well defined to handle this especially at the blueprint level. Then again, maybe I’m not aware of an existing solution.

So i setup an interface everything i was reading was saying this should be the easiest way. So as you can see in my actor blueprint i set up as follows.

Press any key my timeline runs opening the main menu book. At the end of that i have it grabbing all actors that are using my interface and looping through them to output to the interface action.

Inside my widget blueprint its setup like this.

But the event doesn’t seem to be triggering. Is my array not handing the correct piece of information?

Widgets aren’t actors.

OK, i feel stupid that was so obvious. Thank you greatly for the help. Learning terminology is important.

I think i used the wrong terminology, but thank you did lead me in the right direction when i changed from actor to widget. Thank you for helping.

I noticed there’s an “Get All Widgets with Interface”. Give that a try.

BTW, these names are just the names of the base classes.

UserWidget derives from Widget that derives from Visual that derives from Object

UserWidget->Widget->Visual->Object

Actors on the other hand start at Character (these are the most derived aside from custom classes).

Character->Pawn->Actor->Object

So “Get All Actors with Interface” will grab all Characters, Pawns and Actors with said interface because they are all Actors (since it’s that very class or derived from it). But not Widgets because it is not derived from Actor.

As can be seen, it’s not just a matter of terms, but of hierarchy.

1 Like

After you said widgets aren’t actors i instantly found get widget and it worked perfectly.

1 Like

Ah nice! Glad to hear it.

edit: Also, there’s absolutely nothing to feel stupid about. This stuff takes time to learn. I didn’t even know “Get All Widgets with Interface” existed. So your post got me to learn something new :slight_smile:

1 Like

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