UGameplayStatics::SpawnEmitterAttached
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Spawns a Cascade particle system attached to a scene component or socket, so the effect follows the component's movement. Useful for continuous effects like flames, trails, or muzzle flashes.
Caveats & Gotchas
- • This is for legacy Cascade systems (UParticleSystem), not Niagara. For Niagara, use UNiagaraFunctionLibrary::SpawnSystemAttached.
- • If AttachToComponent is null, the function returns null without spawning — null-check the parent component before calling.
- • With bAutoDestroy=true, the component and its particle instance are destroyed when the effect ends, so holding the returned pointer is unsafe unless you know the system loops.
Signature
static ENGINE_API UParticleSystemComponent* SpawnEmitterAttached(class UParticleSystem* EmitterTemplate, class USceneComponent* AttachToComponent, FName AttachPointName = NAME_None, FVector Location = FVector(ForceInit), FRotator Rotation = FRotator::ZeroRotator, FVector Scale = FVector(1.f), EAttachLocation::Type LocationType = EAttachLocation::KeepRelativeOffset, bool bAutoDestroy = true, EPSCPoolMethod PoolingMethod = EPSCPoolMethod::None, bool bAutoActivate=true); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| EmitterTemplate | class UParticleSystem* | Cascade particle system asset to attach. | — |
| AttachToComponent | class USceneComponent* | The component to attach the particle system to. | — |
| AttachPointName | FName | Optional socket or bone name on the component to attach to. | NAME_None |
| Location | FVector | Offset location relative to the attach point. | FVector(ForceInit) |
| Rotation | FRotator | Offset rotation relative to the attach point. | FRotator::ZeroRotator |
| Scale | FVector | Scale of the particle system. | FVector(1.f) |
| LocationType | EAttachLocation::Type | Whether Location is relative or world-space. | EAttachLocation::KeepRelativeOffset |
| bAutoDestroy | bool | Whether the component destroys itself when the system completes. | true |
| PoolingMethod | EPSCPoolMethod | PSC pooling mode. | EPSCPoolMethod::None |
| bAutoActivate | bool | Whether to activate the system immediately on spawn. | true |
Return Type
UParticleSystemComponent* Example
Attach fire effect to a character hand socket C++
UParticleSystemComponent* FireComp = UGameplayStatics::SpawnEmitterAttached(
FireEffectTemplate,
GetMesh(),
FName("hand_r"), // socket name
FVector::ZeroVector,
FRotator::ZeroRotator,
FVector(1.f),
EAttachLocation::SnapToTarget,
false // don't auto-destroy — we'll stop it manually
); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?