RealDocs

AActor::SetInstigator

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public

Description

Sets the instigating pawn responsible for spawning or triggering this actor. The instigator is used by the damage system and can be queried to attribute actions to a specific pawn.

Caveats & Gotchas

  • The instigator is also settable via `FActorSpawnParameters::Instigator` at spawn time, which is the preferred approach for projectiles and spawned effects. Using this setter after spawn is valid but means the instigator was not available during construction.
  • The `Instigator` property is replicated, so setting it on the server will propagate to clients. However, it is stored as a raw pointer — if the instigating pawn is destroyed, it becomes a dangling reference. Always null-check before use.

Signature

ENGINE_API void SetInstigator(APawn* InInstigator)

Parameters

Name Type Description Default
InInstigator APawn* The pawn to set as the instigator of this actor (e.g. the player or AI that spawned or fired it).

Return Type

void

Example

Assign instigator when spawning a projectile C++
void AMyWeapon::Fire()
{
    FActorSpawnParameters SpawnParams;
    SpawnParams.Instigator = GetInstigator(); // preferred at spawn
    AMyProjectile* Proj = GetWorld()->SpawnActor<AMyProjectile>(
        ProjectileClass, MuzzleLocation, MuzzleRotation, SpawnParams);
    // Alternatively, after spawn:
    // Proj->SetInstigator(GetInstigator());
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.