Custom Events & Functions
The I/O system was designed in a way to be easily extensible. You can register custom events and functions with the I/O system for any of your actors using the ActorIOInterface
.
1. Adding the I/O Interface to the Actor
In order to expose custom events and functions, you need to add the ActorIOInterface
to your actor. The LogicActorBase
class already has this interface implemented, so if you are creating a custom logic actor then you can skip this step.
2. Registering Custom Events
Override the RegisterIOEvents
function of the I/O interface, and use RegisterEvent
to add an entry to the event registry of this actor.

void APickupActor::RegisterIOEvents(FActorIOEventList& EventRegistry)
{
EventRegistry.RegisterEvent(FActorIOEvent()
.SetId(TEXT("APickupActor::OnPickup"))
.SetDisplayName(INVTEXT("OnPickup"))
.SetTooltipText(INVTEXT("Event when the item is picked up."))
.SetMulticastDelegate(this, &OnPickup));
}
3. Registering Custom Functions
Override the RegisterIOFunctions
of the I/O interface, and use RegisterFunction
to add an entry to the function registry of the actor.

void APickupActor::RegisterIOFunctions(FActorIOFunctionList& FunctionRegistry)
{
FunctionRegistry.RegisterFunction(FActorIOFunction()
.SetId(TEXT("APickupActor::Pickup"))
.SetDisplayName(INVTEXT("Pickup"))
.SetTooltipText(INVTEXT("Pickup the item from the ground."))
.SetFunction(TEXT("Pickup")));
}
Custom Function for Actor Components
When registering an I/O function for the actor, you can specify a SubobjectName
. If set, the I/O system will call the function on the specified subobject instead of the actor itself.
The SubobjectName
should be the name of a component (or any other subobject) that is part of the actor.
Last updated