Greetings!
I’ve been trying to create an Actor that activates a particlesystem if an event happens. The Actor has 2 events, one of them deactivates the particle system the other activates it. First I made a reference to an AEmitter that was placed in the editor and that time it worked fine, but I dont want a reference to another Actor so I tried to make it with particlesystemcomponent and it does not work.
My Code:
/** Header */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Portal")
UParticleSystem* ParticleTemplate;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Portal")
UParticleSystemComponent* Particle;
/** CPP */
/** Event activating the particle component */
if (!Particle)
{
Particle = UGameplayStatics::SpawnEmitterAttached(ParticleTemplate, RootComponent, NAME_None, GetActorLocation(), GetActorRotation(), EAttachLocation::KeepWorldPosition, false);
}
Particle->ActivateSystem(true);
/** Event deactivating the particle component */
if (Particle)
{
Particle->DeactivateSystem();
}
I hope someone has some suggestions or ideas why this is not working because I’ve been trying to make this happen for a lot of time and I am out of ideas.
Thank you for your time.
Sincerely,
Ákos