Hello all! I am having a strange issue where I am spawning a particle emitter attached to a static mesh whenever the player fires, however the emitter does not always spawn?
It is spawning in the correct location, and if I wait long enough between shots it will spawn every time, however it will not spawn if fired in rapid succession… Here is the line of code for spawning the emitter:
UParticleSystemComponent* NewParticle = UGameplayStatics::SpawnEmitterAttached(MuzzleFlash, SceneComp,FName(TEXT("AttachPoint")), FVector(), FRotator::ZeroRotator,FVector(1,1,1), EAttachLocation::SnapToTarget); //Spawns MuzzleFlash
I have confirmed that it has something to do with the fact that I am using SpawnEmitterAttached()
I used this code:
UParticleSystemComponent* NewParticle = UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), MuzzleFlash, FVector(0, 0, 0), FRotator(0, 0, 0), FVector(1,1,1), true, EPSCPoolMethod::None, true); //Spawns MuzzleFlash
To spawn the emitter at world 0,0,0 and it does spawn every time I fire… Any guidance for where to go next? I want the muzzle flash to follow the weapon, which is why I used SpawnEmitterAttached(), not stay in place after the character moves…