How do I trigger an event in the level blueprint from an external blueprint?

This is probably really easy, but I’m massively more familiar with C++ than blueprint and I’m having a heck of a time figuring it out- I have an actor named WorldManager who runs most of the game logic, and that actor’s code has a BlueprintImplementableEvent event that executes whenever time moves forward:


UFUNCTION(Category = "Time", BlueprintImplementableEvent)
	void AdvanceTimeEvent(int32 currentTimePeriod);

I also have an event in my persistent level blueprint which actually finds the day/time system and increments its value:

What I’m having a really hard time understanding is how I should pass messages between the two: how do I configure this so that when AdvanceTimeEvent fires from my world manager, the level blueprint’s AdvanceTime event gets called and passed the int32 I set in AdvanceTimeEvent?

As far as i know, you can’t access the level blueprint out of other blueprints.

Hmm, okay- that being the case, then, is there any way to accomplish what I’m describing without relying on hard-coded references?

you can add a bool or something in an actor ? and get the value of it through the level blueprint

Have you thought of using an Event Dispatcher to create a delegate call to your AdvancedTime event in the level Blueprint?

I would use the GameState class for this. It is meant to log the current State of the Game and can be accessed
easily in every Blueprint through a global pointer (GetGameState). You can set it in the GameMode.
You can use your LevelBlueprint to pass the Ultra_Dynamic_Sky reference to the GameState.

On BeginPlay, you get your GameState class, cast it and set a variable which you will need to create in your GameState
class to the Ultra_Dynamic_Sky. Then you have the Reference in the GameState and calling events like the one
in your first post will be easy peasy.

Otherwise, you can try using EventDispatcher like Devil said. But i would try to go the GameState way (:

Ooh, I hadn’t heard of the GameState class before, this’ll be fun to play with- thanks for the suggestions! :slight_smile:

No problem. Your best bet is to learn about the Basic GamePlay Framework of Unreal. You will find a lot of useful classes like GameState, PlayerState, GameInstance etc.

Main GamePlay Documentation
Main GamePlay Framework Documentation
GamePlay Framwork Quick Reference