Plugin Documentation

PawnSwap
Pawn switching, possession and vehicle seats

Switch between a roster of pawns with smooth camera blends, climb into cars, boats, turrets and mounts with several seats, get out at a validated free spot, lock seats to owners or teams, show "Press E to enter" prompts, spectate other pawns and save who sits where. Every request is server-authoritative and seat occupancy replicates, so the same setup works in single player, listen servers and dedicated servers.

v1.0
UE 4.27 & 5.8
Win64 & Mac
Category Gameplay
C++ & Blueprint
Network Replicated
Alpha XP

Overview

PawnSwap is built from three components and a function library:

  • Pawn Swap Manager (UPawnSwapManagerComponent) on the PlayerController: switching, roster, entering/exiting seats, interaction, spectating, input and save data.
  • Pawn Swap Seat (UPawnSwapSeatComponent) on a vehicle or mount: one per seat, with entry/exit points, occupant handling and access rules. Occupancy replicates.
  • Pawn Swap Profile (UPawnSwapPawnComponent), optional, on any pawn: roster tag, team, auto registration, interaction switching and per-pawn overrides (blend, controller policy, input).
  • PawnSwap Library (UPawnSwapLibrary): seats of a vehicle, occupants, team lookups, capsule tests.

The 15 features:

  1. Swap manager that possesses another pawn on request.
  2. Smooth view-target blend on every switch (time, function, exponent, lock outgoing).
  3. Roster of switchable pawns: next / previous / index / tag.
  4. Seat component with entry and exit points.
  5. Multiple seats per vehicle: driver / passenger, occupancy, possess the vehicle from the driver seat.
  6. Exit location validation with capsule tests and a fallback search.
  7. Controller policy for the pawn left behind.
  8. Seated occupant handling: attach, hide, collision, movement, restore.
  9. Interaction query for "Press E to enter" prompts.
  10. Seat locking and access rules.
  11. Events for switches, seats and denials (with a reason enum).
  12. Multiplayer: Server RPCs and replicated occupancy with RepNotify.
  13. Spectate mode without possessing.
  14. Input mode per pawn and a Setup Input event.
  15. Save / restore of roster and seat occupancy.

Requirements

RequirementDetails
Unreal Engine4.27 and 5.8
ModulePawnSwap (Runtime)
DependenciesNone (engine modules only; no other plugins are enabled)
PawnsAny APawn; characters get capsule-accurate exits and movement handling
PlatformsWin64 and Mac (the module lists these platforms in the plugin descriptor). The code is platform-independent engine C++ with no OS-specific calls.
Network ReplicatedYes. Vehicles carrying seats must replicate (Replicates on).

Installation

  1. Install PawnSwap from Fab into your engine, or copy the PawnSwap folder into your project's Plugins folder.
  2. Enable PawnSwap in Edit > Plugins and restart the editor.
  3. C++ only: add PublicDependencyModuleNames.Add("PawnSwap"); to your Build.cs.
Verifying the installIn any Blueprint, Add Component lists Pawn Swap Manager, Pawn Swap Seat and Pawn Swap Profile.

Quick start

  1. Open your PlayerController Blueprint and add a Pawn Swap Manager component.
  2. Place two characters in the level. On the second one add a Pawn Swap Profile and tick Auto Register (player index 0). The first pawn you possess is registered automatically (Register Initial Pawn).
  3. In the PlayerController, bind a key (Tab) to Switch To Next. Play: Tab blends the camera to the other character and gives you control.
  4. Open a vehicle Blueprint (any pawn, for example a wheeled vehicle), make sure Replicates is on, add a Pawn Swap Seat under the body where the driver sits. Keep Seat Role on Driver. Add a scene component DoorLeft beside the door and add an Entry Point with Component = DoorLeft.
  5. Bind a key (E) to Interact on the manager. Walk to the door and press E: the character sits in the seat and you drive the vehicle. Press E again to get out at the door (or the nearest free spot).
PromptsTurn on Auto Scan Interaction and bind On Interaction Changed to show or hide a widget with the interaction's Prompt ("Enter", "Take control", "Exit").

1. Swap manager

Component UPawnSwapManagerComponent — displayed as Pawn Swap Manager. Add it to the PlayerController (an AIController also works for server-side switching without camera or input). It replicates; every request made on a client is sent to the server.

NodeTypeDescription
Switch To Pawn (New Pawn)callPossesses New Pawn with the switch blend. If New Pawn sits in a driver seat and drives its vehicle, the vehicle is taken (driving resumes).
Get Controlled PawnpureThe possessed pawn (a vehicle while driving).
Get Character PawnpureThe player's own pawn: the seated driver while driving, otherwise the controlled pawn.
Get Owner ControllerpureThe controller the manager is attached to.
PropertyDefaultDescription
Switch Cooldown0.2Minimum seconds between switches (refused with Cooldown).
Require RosterOnSwitch To Pawn only accepts roster pawns and pawns whose profile has Switchable By Interaction (refused with Not In Roster). Keeps clients from taking arbitrary pawns.
Return To Occupant On Vehicle LossOnWhen the vehicle you drive is destroyed, you get the driver pawn back.

A switch is refused when the target is invalid, already controlled, controlled by another player, not allowed by the roster rule, or requested during the cooldown; see Events.

2. Camera blend

struct FPawnSwapBlendSettings — used by Switch Blend (switching), Seat Blend (entering a driver seat / leaving it) and Spectate Blend.

FieldDefaultDescription
Blend Time0.5 (Seat Blend 0.35, Spectate Blend 0.6)Seconds. 0 cuts instantly.
Blend FunctionEase In OutLinear, Cubic, Ease In, Ease Out, Ease In Out (engine view-target blend functions).
Blend Exp2Exponent of the Ease functions.
Lock OutgoingOnFreezes the outgoing camera at its last frame while blending, so the blend starts exactly where the view was.

Manage Camera (default on) holds the PlayerController's Auto Manage Active Camera Target during the possession so the engine does not cut the view, then restores it and starts the blend. On a remote client the hold and the blend are sent on the controller's reliable channel in order. A Pawn Swap Profile can override the blend for switches to its pawn (Override Blend).

3. Roster

The roster is the ordered list of pawns a player can switch between. It is kept on the server and replicated to the owning client.

NodeTypeDescription
Register Pawn / Unregister Pawn / Clear Rostercall serverEdits the roster (authority only).
Switch To Next / Switch To PreviouscallCycles from the current pawn.
Switch To Index (Index)callRoster position, 0-based.
Switch To Tag (Tag)callFirst pawn whose profile Roster Tag or actor tag matches.
Get Roster / Get Roster Count / Get Active Roster Index / Is In Roster / Find Roster Pawn By TagpureQueries (work on the owning client too).
PropertyDefaultDescription
Register Initial PawnOnThe first pawn the controller possesses joins the roster.
Wrap RosterOnNext after the last goes to the first.
Skip Controlled By OthersOnNext / Previous skip pawns another player controls.

Pawns can also register themselves with a Pawn Swap Profile (Auto Register, Auto Register Player Index; -1 = every player). Destroyed pawns are removed automatically.

4. Seats & points

Component UPawnSwapSeatComponent — displayed as Pawn Swap Seat. A scene component: its transform is where the occupant sits. The vehicle actor must replicate.

struct FPawnSwapSeatPoint — an entry or exit point: Component (name of a scene component of the vehicle, None = the seat itself) plus an Offset transform relative to it. The offset rotation sets the facing after an exit.

PropertyDefaultDescription
Display NameSeatName for UI.
Entry PointsemptyWhere the seat can be entered from. Empty = the seat location.
Exit PointsemptyPreferred exit locations in order. Empty = the entry points.
Max Enter Distance300Maximum distance from the pawn to the nearest entry point (0 = no limit). Refused with Out Of Range.
Interaction Prompt / Exit PromptEnter / ExitTexts returned by interaction queries.

Point helpers: Get Point Transform, Get Entry Transforms, Get Exit Transforms, Get Nearest Entry Location. Manager nodes: Enter Seat (Seat), Exit Seat, Get Current Seat, Is Seated.

5. Multi-seat vehicles

Add one Pawn Swap Seat per seat. Seats of the same actor form the vehicle.

PropertyDefaultDescription
Seat RoleDriverDriver or Passenger.
Possess Vehicle On EnterOnDriver seat of a pawn vehicle: the player possesses the vehicle when entering (with Seat Blend) and gets the occupant back when leaving. Passengers keep controlling their own (seated) pawn.
Priority0Lower values are offered first by Enter Vehicle and Get Free Seat.
NodeTypeDescription
Enter Vehicle (Vehicle, Prefer Driver)call managerEnters the best free seat (driver first when Prefer Driver, then by Priority).
Change Seat (New Seat)call managerMoves to another seat of the same vehicle (no exit check). Moving to the driver seat takes the vehicle, moving away from it gives the occupant back.
Get Occupant / Is Occupied / Is Occupant Possessing Vehiclepure seatOccupancy (replicated).
Get Vehicle / Get Vehicle Pawn / Get Sibling Seatspure seatThe owning actor and its other seats.
Seat Pawn / Unseat Pawn / Vacate Seatcall seat, serverSeat or unseat any pawn directly (AI passengers, cutscenes). These do not change possession; players should use the manager.

6. Exit validation

Find Exit Transform (For Pawn) is used by every exit. It uses the pawn's capsule (character capsule, capsule root, collision cylinder, else the defaults) and tries, in order:

  1. Each exit point (or entry point): snapped to the ground below, tested with a capsule overlap and a line of sight from the seat (the vehicle itself is ignored for the sight test).
  2. Fallback rings around the vehicle bounds, starting on the side of the seat and alternating left/right.
  3. The roof of the vehicle.

If nothing is free the exit is refused with Exit Blocked and the occupant stays seated. struct FPawnSwapExitSettings (seat property Exit Settings):

FieldDefaultDescription
Overlap ChannelPawnChannel of the capsule test.
Trace ChannelVisibilityChannel of the ground and sight traces.
Snap To Ground / Max Ground DistanceOn / 250Moves each candidate onto the ground below it.
Require GroundOnRejects candidates without ground (cliffs, water edges).
Require Line Of SightOnRejects candidates behind walls.
Use Fallback SearchOnSearch rings when every point is blocked.
Fallback Steps / Fallback Rings / Ring Spacing12 / 2 / 60Candidates per ring, number of rings, distance between the bounds and rings.
Allow Roof ExitOnLast resort: on top of the vehicle.
Default Radius / Default Half Height40 / 90Capsule when the pawn has no collision shape.
Draw DebugOffDraws every tested capsule for 3 s (green free, red blocked), development builds.

Library: Is Capsule Free and Get Pawn Collision Size for your own placement checks.

7. Left-behind pawns

enum EPawnSwapLeftBehind decides what happens to the controller of the pawn you leave:

ValueResult
Leave UnpossessedThe pawn stays without a controller.
Spawn AI ControllerThe pawn spawns its AI Controller Class and is possessed by it.
Restore Original ControllerThe controller that had the pawn before you took it (for example its AI) gets it back; falls back to Spawn AI Controller.

Used by the manager's Left Behind Policy (default Leave Unpossessed), a profile's Left Behind Policy when Override Left Behind is on (profile default Spawn AI Controller), and the seat's Vehicle On Exit for the vehicle a driver leaves (default Leave Unpossessed). A driver who switches away keeps sitting in the vehicle, which stays unpossessed; switching back to that pawn resumes driving.

8. Seated occupant

PropertyDefaultDescription
Occupant SocketNoneSocket of the component the seat is attached to (for example a skeletal mesh socket of a mount). None = attach to the seat itself.
Occupant OffsetidentityLocation/rotation relative to the seat or socket (for example a capsule half height up so the feet are on the floor).
Hide OccupantOffHidden while seated (enclosed cockpits).
Disable Occupant CollisionOnActor collision off while seated.
Disable Occupant MovementOnCharacter movement set to None (other movement components are deactivated).
Ignore Controller RotationOnUse Controller Rotation Pitch/Yaw/Roll off while seated, so a passenger can look around without turning in the seat.

The previous state (collision, visibility, movement, controller rotation flags) is stored when the pawn sits down and restored when it leaves; the pawn is detached and stood upright. The same handling runs on every machine through the occupancy RepNotify, so collision and movement are correct on clients too.

9. Interaction query

Find Best Interaction returns an struct FPawnSwapInteraction: Type (None, Seat, Pawn, Exit), Seat, Pawn, Distance, View Angle, Prompt and Deny Reason. While seated it returns Exit. Interact runs the best one (enter, take over, exit); Interact With runs a given result.

Settings (Interaction, FPawnSwapInteractionSettings):

FieldDefaultDescription
Radius350Maximum distance from the controlled pawn to the entry point or pawn.
Max View Angle60Degrees between the view direction and the target.
Angle Weight0.60 = nearest wins, 1 = closest to the view centre wins.
Include Seats / Include PawnsOn / OnPawns need a profile with Switchable By Interaction.
Include DeniedOffAlso return refused targets (Deny Reason filled) to show "Locked".
Require Line Of Sight / Line Of Sight ChannelOff / VisibilityClear line from the view point to the target.

Auto Scan Interaction (default off) queries every Scan Interval seconds (default 0.1) on the owning client and fires event On Interaction Changed when the target changes; Get Current Interaction returns the last result.

10. Locks & access

PropertyDefaultDescription
LockedOffRefuses everyone (Locked). Replicated; change with Set Locked (server).
AccessAnyoneAnyone, Owner Only, Same Team, Owner Or Same Team. Replicated; Set Access.
Team Id0Seat team for Same Team rules. Replicated; Set Team Id.
Claim On First EnterOnOwner rules: the first player to enter an unowned seat becomes its owner (their Player State).

Set Seat Owner (server) accepts a controller, player state or pawn; Get Seat Owner reads it. A pawn's team is its profile Team Id when 0 or more, otherwise the manager's Team Id (default 0, set with Set Team Id on the server). Check Access (Candidate, Controller) returns the deny reason without entering. Override event Check Custom Access in a seat subclass for keys, factions or quest state (refused with Custom Rule).

11. Events

EventOnParameters
On Pawn SwitchedManagerNew Pawn, Old Pawn
On Seat Entered / On Seat ExitedManagerSeat, Seated Pawn
On Enter Denied / On Exit DeniedManagerReason, Seat
On Switch DeniedManagerReason, Target Pawn
On Setup InputManagerNew Pawn, Old Pawn (owning client, see Input)
On Spectate ChangedManagerTarget, Spectating
On Interaction ChangedManagerInteraction
On Occupant ChangedSeatSeat, New Occupant, Previous Occupant (every machine)
On Swap Possessed / On Swap ReleasedProfileNew Controller

Manager switch, seat and deny events fire on the server and on the owning client (once in standalone and on a listen-server host). enum EPawnSwapDenyReason: None, Invalid Target, No Pawn, No Authority, Locked, Not Owner, Wrong Team, Occupied, Out Of Range, Already Seated, Not Seated, Exit Blocked, Controlled By Other Player, Not In Roster, Already Controlled, Cooldown, Custom Rule.

12. Multiplayer

  • Switch, enter, exit and change-seat calls made on a client go to the server with reliable Server RPCs; the server validates everything (roster, access, range, exit space) and answers through the events.
  • Seat Occupant replicates with a RepNotify that attaches/detaches and applies/restores the occupant state on every client; lock, access rule, team and owner replicate too.
  • The roster, the current seat and the team id replicate to the owning client only.
  • Camera blends reach remote clients through the engine's view-target replication; the manager holds the client's automatic camera during the possession so the blend is not cut.
  • After an exit the server teleports the pawn and sends the owning client its new location.
Vehicles must replicateSeat components replicate through their actor: tick Replicates on vehicles and mounts (pawns usually do already).

13. Spectate

NodeTypeDescription
Spectate (Target)callBlends the view to any actor without possessing it. Call again to move to another target.
Spectate Roster (Direction)callNext (1) or previous (-1) roster pawn other than yours.
Stop Spectating (Blend)callReturns the view to the controlled pawn.
Is Spectating / Get Spectate TargetpureState.

Spectating is a view change on the owning client (the server keeps you possessing your pawn). Ignore Input While Spectating (default on) blocks move and look input until you return; any possession change ends spectating.

14. Input per pawn

struct FPawnSwapInputSettings — applied on the owning client after every switch: the new pawn's profile Input when Override Input is on, else the manager's Default Input.

FieldDefaultDescription
ModeUnchangedUnchanged, Game Only, Game And UI, UI Only.
Set Mouse Cursor / Show Mouse CursorOff / OffChanges the cursor visibility.
Lock Mouse To ViewportOffGame And UI / UI Only mouse lock.
Hide Cursor During CaptureOnGame And UI.

Then event Setup Input For Pawn (overridable in a manager subclass) and event On Setup Input fire: add input mapping contexts, bind actions or show the pawn's HUD there. Apply Input Settings applies a settings struct at any time.

15. Save / restore

Export State returns struct FPawnSwapSaveData (all fields marked SaveGame): Pawns (actor name, roster tag, class, transform), Active Index (your pawn, or the driver while driving) and Seats occupied by roster pawns (vehicle name/tag, seat name, occupant index, driving, locked). Store it in your SaveGame object.

Restore State (Data, Restore Transforms, Spawn Missing) on the server: frees the seats held by your pawns, finds each pawn by Roster Tag (profile tag or first actor tag) or by actor name, respawns missing ones from their class when Spawn Missing is on, moves them when Restore Transforms is on, rebuilds the roster, re-seats the occupants, restores seat locks and possesses the active pawn (or its vehicle when it was driving). Both default to on.

Stable keysPawns and vehicles spawned at runtime get new names on every run: give them a unique Roster Tag (profile) or actor tag so Restore State can find them.

Pawn Swap Profile

Component UPawnSwapPawnComponent — displayed as Pawn Swap Profile. Optional, on any pawn.

PropertyDefaultDescription
Roster TagNoneKey for Switch To Tag and save/restore.
Display NameemptyName for UI.
Team Id-1-1 = use the controller's manager team.
Auto Register / Auto Register Player IndexOff / 0Registers the pawn with that player's manager on the server (-1 = every player; retried while players join).
Switchable By Interaction / Interaction PromptOff / Take controlOffered by interaction queries and accepted by Switch To Pawn without being in the roster.
Override Left Behind / Left Behind PolicyOff / Spawn AI ControllerController policy when a player leaves this pawn.
Override Blend / BlendOff / 0.5 s Ease In OutCamera blend when switching to this pawn.
Override Input / InputOff / UnchangedInput mode when this pawn becomes controlled.

Blueprint library

Function Library UPawnSwapLibrary — category PawnSwap.

NodeTypeDescription
Get Manager Of Controller / Get Manager Of PawnpureThe Pawn Swap Manager of a controller, or of the controller of a pawn.
Get Pawn ProfilepureThe Pawn Swap Profile of a pawn.
Get Seats / Get Driver Seat / Get Free Seat / Get OccupantspureSeats of a vehicle (by Priority), its driver seat, the best free seat for a pawn, seated pawns.
Find Seat Of Pawn / Is Pawn SeatedpureWhere a pawn sits.
Get Pawn Team IdpureTeam used by access rules.
Get Pawn Collision Size / Is Capsule Freepure / callCapsule of a pawn and a free-space test.
Get Save KeypureThe key save data uses for an actor.

C++

#include "PawnSwapManagerComponent.h"
#include "PawnSwapSeatComponent.h"
#include "PawnSwapLibrary.h"

// In your PlayerController
UPROPERTY(VisibleAnywhere)
UPawnSwapManagerComponent* Swap;

AMyPlayerController::AMyPlayerController()
{
    Swap = CreateDefaultSubobject<UPawnSwapManagerComponent>(TEXT("Swap"));
    Swap->SwitchBlend.BlendTime = 0.4f;
    Swap->LeftBehindPolicy = EPawnSwapLeftBehind::SpawnAIController;
    Swap->bAutoScanInteraction = true;
}

void AMyPlayerController::OnInteractPressed()  { Swap->Interact(); }
void AMyPlayerController::OnNextPressed()      { Swap->SwitchToNext(); }

// AI passenger (server)
if (UPawnSwapSeatComponent* Seat = UPawnSwapLibrary::GetFreeSeat(Bus, Npc, false))
{
    Seat->SeatPawn(Npc);
}

// Save game
MySave->Swap = Swap->ExportState();
Swap->RestoreState(MySave->Swap, true, true);

Troubleshooting

SymptomCause and fix
Switch is refused with Not In RosterRegister the pawn on the server (Register Pawn or a profile with Auto Register), or turn off Require Roster.
Nothing happens on a clientThe manager must be on the PlayerController (the only actor a client may send Server RPCs from), and vehicles must replicate.
The camera cuts instead of blendingCheck Manage Camera and the blend time. On clients the target pawn must already be replicated (relevant); a far pawn that is not yet relevant is cut to when it arrives.
Exit Blocked although there is roomExit points may be inside the vehicle collision or below the ground: turn on Draw Debug in Exit Settings. Raise Max Ground Distance on uneven terrain.
The occupant floats or sinks in the seatCharacters attach at their capsule centre: move the seat component, or adjust Occupant Offset (location and rotation relative to the seat or socket).
Restore State finds nothingRuntime-spawned actors need a Roster Tag or actor tag; keep Spawn Missing on to recreate pawns.

Credits

© 2026 Alpha XP — alphaxp.net · Support: support@alphaxp.net. Built for Unreal Engine 4.27 and 5.8.