I have a project where a stage is randomly generated, it consists of pre-made rooms. Some of the rooms can have a trigger box to check if the player is in it. But from what I know a trigger OnBeginActorOverlap can only be set in the Level Blueprint, so it has to be present at the start.
How would I go about adding behaviour to generated trigger boxes OnBeginActorOverlap?
Can this be done without using the Level Blueprint?
[Event Dispatchers][1] is the first thing that comes to mind. You can register events from any actor like so:
Here, the Third Person Character will receive a call from the room whose box gets overlapped, the Room actor will send the listed data. That’s the default behaviour, if you wish to push more data from a room, you can create your own custom dispatcher and have the room call it when the box overlap triggers.
You can bind / unbind events dynamically and any number of actors can register with the same dispatcher.
edit: in the screenshot I do it with a component, you can do it with the entire Actor, of course. Or any of its components.
Thank you for the quick and detailed answer! I really appreciate it.
So I’ve been trying to get it to work and I see progress already, but how would I get that event you have linked into “Bind Event to…” part?
Is it a custom event?
Edit: It is I just can’t read… My bad, thank you! I’ll try and see if it works now.
Edit 2: I got it to work, thanks a lot!
Ah, yes! I should have mentioned it. Assign will auto-create an Event with the correct signature.
Good luck!