Create a particle emitter in your project as a template. Delete the initial velocity attribute for the emitter in Cascade. Change the data type to GPU Sprites. Create and assign a material to the emitter. This is done by clicking in the black area of the Emitters window and scrolling down to the bottom of the Details window.
Actor Code
SET UP:
UParticleSystemComponent* particleSystemComponent = CreateDefaultSubobject<UParticleSystemComponent>(TEXT(“ParticleComponent”));
particleSystemComponent->SetupAttachment(RootComponent);
particleSystemComponent->bAutoActivate = false;
static ConstructorHelpers::FObjectFinder<UParticleSystem> pointCloud(TEXT("/Game/EmitterName"));
if (pointCloud.Succeeded())
{
UE_LOG(LogTemp, Warning, TEXT(“Particle system template loaded”));
particleSystemComponent->SetTemplate(pointCloud.Object);
}
PARTICLE CREATION:
TArray<FVector> points = TArray<FVector>();
// generate points
for (auto point : points)
{
UGameplayStatics::SpawnEmitterAttached(_particleSystemTemplate, RootComponent, TEXT(“p”), point + GetActorLocation(), FRotator(0.0f, 0.0f, 0.0f), EAttachLocation::KeepRelativeOffset, false);
}
Place the C++ actor anywhere in your scene and it should work.