Announcement

Collapse
No announcement yet.

Particle system not rendering

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Particle system not rendering

    Hi,

    I am writing a 2D game in UE4 (4.25.2) and C++. I am playing with particles for the first time and my particle does not appear in the level.

    I spawn my particle system using:

    void ALaser::BeginPlay()
    {
    Super::BeginPlay();

    ParticleComponent = UGameplayStatics::SpawnEmitterAttached(ParticleTemplate, RootComponent, NAME_None, GetActorLocation(), GetActorRotation(), EAttachLocation::KeepWorldPosition, false);
    ParticleComponent->ActivateSystem(true);
    }

    ParticleTemplate is my particle system, which loads correctly as the pointer is valid. It contains a material that was generated from a 2D texture.

    Putting this aside, I tried simply to drag my particle asset into the level and as expected, it animates just fine in the viewport.

    If I play "Simulate" then the particle appears fine in the level while my game is playing.

    If I then try play in "Selected Viewport", "New Editor Window" or "Standalone Game", then this dragged in particle asset does not appear.

    I thought it could be a 2D camera issue, but I tried changing the camera back to perspective mode and I still don't see this dragged in particle.

    Back to my code, it appears SpawnEmitterAttached() is returning null, which I don't know why.

    So go get around that, even if I create the UParticleSystemComponent by hand in the code and set up all the variables (as per the UE4 source code), and I have what looks like a valid component, even then the particle does not spawn in my game.

    Any ideas?
    Last edited by Manjinder70; 07-30-2020, 12:15 PM.
Working...
X