I’m trying to have an Event Dispatcher on a Blueprint called BP_Platform where when the Player Overlaps the Platform an Event should get fired on the Level Blueprint which subscribed to the EventDispatcher on the BP_Platform in order to spawn an Explosion on the Platform.
I have the Blueprint setup like this:
Weird is that it works in the Editor but when I build it to a Windows Ship the Explosion is not being spawned and I wonder why?
And I apologize for this beginner question since I’m very new to Unreal Engine and Blueprint Scripting, so any input on this would be highly appreciated!
How and in what class do you bind to this event?
It may be that it’s not calling and reacting to the event is broken, but binding to the event.
As shown in the Screenshots I call the event in the BP_Platform and I am binding (subscribing) to the Event “PlatformPressed” inside the Level Blueprint to call this function. The BP_Platform is setup in the Level Editor.
My suggestion: Can it be that the Level Blueprint binds to the event before the BP_Platform EventGraph is being initialized which later on calls the Event Delegate?
Ah, I guess I know what the issue is.
You use ActorBeginOverlap, but since the platform is a solid object that blocks the character, it’s never going to be overlapped.
Even if you force the actual physical overlapping of the platform and the character, the engine will still not fire the ActorOverlap event, because these two actors aren’t supposed to overlap each other.
I suggest adding a trigger box component to the platform BP and use the component overlap instead.
In fact it does overlap since I’ve set the Collision Preset of the BP_Platform->StaticMesh to “OverlapAllDynamic” like so:
And as stated the collision works fine in the editor.
The problem is that the EventDispatcher is not getting called when I compile/build/ship the game as a executable program (in this case as an exe since it’s compiled for windows).
Okay, I see.
Try adding a short delay before subscribing to the platform event in the level BP, if you’re doing it on BeginPlay.
I guess the initialization sequence may differ in the editor and in the standalone build.
Ok so adding a delay worked and I moved the part where the explosion happens in to a seperate function which will get called by the delegate:
But I have a hard time accepting this as an answer since it’s very dangerous to assume that the level is being loaded after X Seconds… Isn’t there another way to tell Unreal to actually wait until the loading sequence is finished so that the events can be bound?
As suggestion: If you bind it in begin play of The actor rather than level bp you could save yourself the workaround.
That was exactly what it needed to work.
@Tuerer 's workaround might helped with the level blueprint to get the events bound on level startup but the delay is something that wouldn’t be too efficient since I had to do the workaround like provided in my last post.
@pezzott1 for what I can tell then the only problem was the dev (in this case me) ignoring the best practice solution.
Anyway thank you both your inputs really helped me a lot!
Have a great weekend!