Interaction Payloads
Documentation Unreal Engine Player Combat Interaction
An interaction option's Payload is what the character does when it runs: walk up to the chest, play the opening, and tell the chest the frame the lid lifts. A dodge can break out of it.
Set it up
10 minutes- 1
Make the chest
Create a Blueprint ActorBP_Chestwith a collision mesh, and tick Replicates. Add an Arrow where the character should stand, pointing at the chest, withOpenSpotin its Component Tags, then UPC Interactable.Components+ AddBP_Chest (Self)Static MeshAddArrowAddUPC InteractableAddThe arrow marks the spot and its facing. - 2
Add the Open option
Add an Options element: Option IdOpen, VerbOpen, NameChest. Set Payload to Play Montage with the demo'sAM_UPC_ChestOpen, which already carries the commit notify on the frame the hands lift the lid, and Approach, Spot Component Tag toOpenSpot.DetailsUPC InteractableUPC
Interactable
Options1 Array elementIndex [ 0 ]Option IdOpenActivation Input TagUPC.Input.InteractPromptVerbOpenNameChestIconNonePayload (Optional)Play MontageMontageAM_UPC_ChestOpenPlay Rate1.0Section NameNoneApproachSpot Component TagOpenSpotAcceptance Radius0.0Override TimeoutRestrictionsCancel by AbilityPriority0EnabledAnchor Component TagNoneAnchor SocketNoneThe character walks onto the component tagged OpenSpot, plays the montage, and the chest hears On Option Interacted at the montage's commit notify. - 3
Open the lid when it lands
Add a BooleanIsOpenset to RepNotify. Set it true from On Option Interacted (server) and swing the lid inOnRep_IsOpenso every player sees it. - 4
Press Play
Press E beside the chest: the character walks onto the arrow, turns, plays the opening, and the lid swings as the hands lift it.
Pick a payload kind
| Kind | Does, and lands |
|---|---|
| (empty) | Nothing on the character; lands at once. |
| Play Montage | Plays Montage at Play Rate from Section Name; lands at its commit notify, else as it blends out. |
| Delay | Waits Delay Seconds (0.5), for a search with no animation. |
| Trigger Ability / Event | Sends a gameplay event to the character, or activates its abilities carrying Ability Tags; lands straight after. |
| Run Ability | Hands the option to an ability of the character's: no walk, no restrictions, no On Option Interacted. |
| Payload Asset | Runs an Action Payload asset, a reusable Blueprint object; lands at a commit notify, else when it finishes. |
| World Item Pickup | The reach every world item's Pick Up row carries (Pickups, Drops and Holders); lands as the hand closes. |
The Interactor skips a row missing what its kind needs; the actor's other rows still show. Every kind but empty and Run Ability plays through the Interactor's Payload Ability Class, which the interaction module grants on its own.
The moment it lands
An option commits on the frame it takes effect. Mark it with a UPC Gameplay Event notify whose Event Tag is
UPC.Event.Interaction.Commit: the actor's On Option Interacted fires once, on the server, and the Interactor fires On Interaction Committed.AM_MyChestOpen
0.0
0.25
0.5
0.75
1.0
1.25
1.5
1.75
2.0
Notifies
UPC Gameplay Event: UPC.Event.Interaction.Commit
Chest
hands reach the lid
lid opens (On Option Interacted)
An option cut short before its commit runs nothing, and the actor hears On Option Cancelled. A cut after the commit changes nothing: On Option Interacted has run and On Option Cancelled does not follow.
Walk onto a spot first
Name a tagged scene component in the option's Approach, Spot Component Tag: the character walks onto it at its own speed, turns the way it points, then plays the payload.
Details
UPC Interactable
Options [0]
Approach
Approach
Spot Component Tag
OpenSpot
Acceptance Radius
0.0
Override Timeout
Advanced
Advanced
Mode
Move and Face
Restrictions
Restrictions
Lock Movement
Lock Facing
Lock Camera
End Running Action
The defaults: walk onto the spot and turn to its facing, then hold movement and facing and end any running attack for as long as the interaction runs. The camera stays free.
| Setting | Does |
|---|---|
| Spot Component Tag | The component to stand on; empty plays where the character stands. |
| Acceptance Radius | How close counts as arrived; 0 uses the Interactor's Approach Acceptance Radius (5 cm). |
| Override Timeout, Timeout | This option's patience, in place of the Interactor's Approach Timeout (0, no limit). |
| Mode (Advanced) | Move and Face, Face Only (turn in place, for a lever) or Move Only. |
The Interactor's Approach Acceptance Angle (5 degrees; Move Only ignores it) and Approach Stall Seconds (2, ending a walk into a wall) apply too. Giving up cancels with Could Not Reach. The walk uses the character's UPC Attack Approach and Character Movement components, both on the character base.
What the character gives up while it runs
Restrictions hold from the moment the server confirms the option until it ends, the walk included.
| Setting | Default | Does |
|---|---|---|
| End Running Action | On | Ends the swing playing as the option starts. Off, that swing finishes. |
| Lock Movement | On | Stops the player walking it. |
| Lock Facing | On | Keeps the facing the walk left. Needs UPC Attack Approach. |
| Lock Camera | Off | Stops the player turning the camera. |
The character also holds
UPC.State.Interacting and UPC.State.ActionsBlocked while the option runs, which drops combat presses.Let a dodge break out
The dodge has to be a gameplay ability granted on its own key (Input), since
UPC.State.ActionsBlocked shuts the action graph, dodge move included. The demo's GA_UPC_Dash (Demo/Abilities) is set up this way; no demo ability set grants it. Three edits:- The ability. In its Class Defaults, add
UPC.Ability.Interactionto Cancel Abilities with Tag (what it ends as it starts) and keepUPC.State.ActionsBlockedout of Activation Blocked Tags (what stops it starting). - The ability set. Add a row to the character's ability set naming
GA_UPC_Dash, with the dodge's Input Tag and Input Action. - The action graph. The graph answers a key before a granted ability, so delete its transition on the dodge's Input Tag (or give the ability another tag), or the graph's dodge takes the press.
Cancel by Ability on the option, on by default, allows the break. Off, the option also ignores Cancel All Abilities, such as a call a game makes on death.
Undo a half-done job in On Option Cancelled. Its Reason:
| Reason | When |
|---|---|
| Cancelled By Ability | A dodge, stagger or hit reaction took over. |
| Approach Superseded | Something else steered the character before it arrived. |
| Interrupted | The animation stopped, or the action ended early. |
| Lost | The character or actor went away, the actor stopped allowing the option, or the ability left. |
| Could Not Reach | The walk gave up. |
Answer per character
A door the character pulls from one side and pushes from the other implements the UPC Interaction Option Provider interface (Class Settings, Interfaces). Each function gets the option's own setting as Authored and returns true with a replacement, or false to keep Authored; a function you leave unimplemented returns false.
| Function | The door answers |
|---|---|
| Get Interaction Approach | Return true and Authored copied with Spot Component Tag set to the near side's tag, so Acceptance Radius and Mode stay as authored. |
| Get Interaction Payload | A Play Montage of the pull or the push. Payload holds any payload kind, so wrap it: Make Play Montage into Make Instanced Struct, into Payload. |
| Get Interaction Restrictions | What this character may still do. |
They run once as the option starts, so a trace is fine, and cannot change actor variables; the option's events carry the answered row.
An answer must run through the same ability as the authored row's kind, or the authored row plays and a warning logs:
| Authored row | Answers it accepts |
|---|---|
| Any kind but empty and Run Ability | Any of those kinds (a pull montage answered with a push montage) |
| Run Ability | A Run Ability naming the same ability |
| Empty | Empty |
A payload of your own
- Make a Blueprint Class of
UPCActionPayloadnamedBP_SearchShelfand override Execute. Its Host pin is the ability running the payload: drag off it for Play Montage, Play Delay or Get Payload Target Actor (the actor). Return what Play Montage or Play Delay returns: true keeps the run going until that montage or wait ends, and the end lands the option. False ends the run and lands it at once. - Right-click in the Content Browser, UPC, Actions, Action Payload, pick
BP_SearchShelfand name itPA_SearchShelf. - Set the option's Payload to Payload Asset with that asset.
BP_SearchShelf · Execute: search for 2 seconds, then the option lands
Execute
Host
Play Delay
Target
Seconds2.0
Return Value
Return Node
Return Value
Details
UPC Interactable
Options [0]
Payload (Optional)Payload Asset
Payload (Optional)
Payload Asset
Payload
PA_SearchShelf
Runs an Action Payload asset from the Content Browser, such as a Blueprint payload of your own.
Every option using the asset shares that one object, so keep no per-run state in its variables.
Hand the option to an ability
Run Ability passes the option to an ability the character has.
Details
UPC Interactable
Options [0]
Payload (Optional)Run Ability
Payload (Optional)
Run Ability
Ability
None
Event Tag
None
The named ability takes the option from here.
- Grant the ability once, in the character's ability set (Input).
- In its Class Defaults, set Net Execution Policy to Server Initiated or Server Only; any other makes the row invalid. Set Net Security Policy to Server Only, or Data Validation warns.
- Implement Activate Ability From Event. The plugin starts the ability itself with Event Tag (
UPC.Event.Interactionwhen empty), so it needs no trigger of its own; the event's Target is the actor, and Get Interaction Option Id on the event's Target Data names the option the player chose.
Debug it
Log LogUPCInteraction Verbose says why a walk gave up or an actor refused its commit; Interaction covers the overlay.AdvancedHow a run goes
The server confirms the optionA cancel at any stop skips to the end
1
Take what the option asks for
Restrictions
A running attack ends (End Running Action), and walking, facing and the camera are held as the Restrictions say. The character reports On Interaction Started.
2
Walk onto the spot
Approach
With a Spot Component Tag, the character walks onto that component at its own speed and turns to its facing. Without one, the payload runs where the character stands.
3
Check again on arrival
Can Interact on the interactable
After a walk, the interactable is asked Can Interact once more, and the server checks the character is still in reach. A no cancels the run with Lost. With no walk, this step is skipped.
4
Play the payload
Play Montage, Delay, Trigger Ability / Event, Payload Asset
The montage plays, the delay runs, the event is sent or the payload asset runs, on the server and on the player's own machine.
5
Commit
a UPC Gameplay Event notify on UPC.Event.Interaction.Commit, or the payload's end
The interactable hears On Option Interacted, once, on the server. The character reports On Interaction Committed. A montage with no commit notify commits as it starts blending out.
6
End
On Interaction Ended, On Option Cancelled
The holds come off and the character reports On Interaction Ended. A run that ended before its commit tells the interactable On Option Cancelled with the reason instead.
A dodge naming UPC.Ability.Interaction in Cancel Abilities with Tag, a montage that is stopped, or a walk that gives up all end the run early; before the commit, nothing commits.
- On arrival, Can Interact runs again and the server checks reach: within Detection Radius of the actor, or on the spot, plus the arrival radius and 0.3 s of walking. A no cancels with Lost; Face Only skips it.
- A character another approach steers, such as an attack glide, cancels with Approach Superseded.
- An actor destroyed before the commit cancels with Lost; after it, the run lands.
- Lock Movement and Lock Camera reach a possessed character only.
- A payload ability whose Asset Tags lose
UPC.Ability.Interactionwarns, since no dodge can then break its interactions.
The demo
BP_UPC_Chest (Open, Break) and BP_UPC_Door (Open, Kick) set a replicated variable on the server and play it in its RepNotify. BP_UPC_Door answers all three per-character functions, from the side the character stands on.MultiplayerWhat runs where
Only the server starts, abandons or commits a payload, and its end is final. The player's machine plays the walk and montage from its own copy of the actor, with no payload sent.
- The player's own movement walks the character, so the walk is predicted; a client copy that loses its option or montage ends alone.
- Per-character answers run on each machine, so read shared state such as positions; in a door's hinge plane the machines can pick different sides.
- A dodge the server refuses, after the player's machine cancelled, leaves the player cancelled while the server commits.
- The server judges a remote player's arrival on each move, and accepts one at rest after walking toward the spot within the widened reach.
C++C++
- A payload kind derives from
FUPCInteractionPayloadSpec(aUSTRUCTwith aDisplayName), overridingIsDefinitionValid,ResolveExecutionAbilityClass,GetExecutionTriggerTag,CanStartandBuildPayload. Build it withInitializeAs<FYourSpec>();TInstancedStruct::Makegiven a derived value keeps only the base. - A native payload derives from
UUPCActionPayload, overridingExecute(UUPCPayloadHostAbility& Host)and optionallyCanStartandCollectPreloadAssets;GetActionGraph()is null in an interaction. IUPCInteractionOptionProviderusesGetInteractionApproach_Implementation,GetInteractionRestrictions_ImplementationandGetInteractionPayload_Implementation(anFInstancedStructholding anFUPCInteractionPayloadSpec).UUPCInteractionPayloadAbility::GetInteractableandGetOptionread the running option.- A Run Ability's event carries the Option Id in its target data:
UUPCInteractionStatics::GetInteractionOptionId(EventData.TargetData)reads it, andFGameplayAbilityTargetData_UPCInteraction::Find(EventData.TargetData)returns the actor andOptionId.
AdvancedTroubleshooting
| Log | Fix |
|---|---|
| "... built nothing to run" | Fill in the payload. |
| "... names approach spot tag '...', but no scene component on the actor carries it" | Tag the component, or clear the field. |
| "... has no Character Movement component to walk with" | Add one, or set Mode to Face Only. |
| "... has no Attack Approach component to hold it" | Add UPC Attack Approach. |