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
.
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.
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. The following types are supported:
Blueprint event dispatchers
C++ dynamic multicast delegates
C++ sparse delegates

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));
}
When registering an I/O event, you can also assign an Event Processor for the event. These are used when your event has parameters, and you want to expose them as Named Arguments for actions to use.
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. The following types are supported:
Blueprint functions
Blueprint custom events
C++ functions marked as
UFUNCTION
(no specifiers required)

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")));
}
When registering an I/O function for an 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. Using this, you can expose functions from components of your actor.
The SubobjectName
should be the name of a component (or any other subobject) that is part of the actor by default. Note that this only works for default subobjects! Dynamically added components will not work.
Last updated