[Scene Graph] particle_system_component cannot be disabled via code

Summary

Any attempts to disable particle_system_component result in them continuing to be rendered in the game.

Please select what you are reporting on:

Unreal Editor for Fortnite

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

  1. Create an Entity Prefab.
  2. Add a component to it in the prefab.
  3. Add a new entity to the prefab and place any particle_system_component on it.
  4. Place the prefab on the scene and start the game.
test_desc_components<public> := class<final_super>(component):

    OnBeginSimulation<override>():void=
        Print("On Begin simulation")
        if(FortRoundManager := Entity.GetFortRoundManager[]):
            FortRoundManager.SubscribeRoundStarted(OnRoundStart)


    OnRoundStart<private>():void=
        Print("On Round Start")
        
        var VFXs : []particle_system_component = array{}
        for(Component : Entity.FindDescendantComponents(particle_system_component)):
            set VFXs += array{Component}

        Print("Total VFXs found {VFXs.Length}")

        for(VFX : VFXs):
            VFX.Stop()
            VFX.Disable()
            if(VFX.IsEnabled[]):
                Print("ERROR: ENABLED.")
            else Print("SUCCESS: DISABLED.")

Expected Result

VFX rendering should be disabled in the game.

Observed Result

VFX rendering continues to work in the game

Platform(s)

windows

Works fine for me. I just Disable() as this in itself would stop them. Maybe you need to use Stop() then Sleep(0.0) then Disable() some things need 1 tick between function calls.

I think it depends on how your niagara is setup:

On a niagara usually there is 3 lifetimes involved: system (the simulation), emitter (for each emitter you yave in the system), and particle (for each particle you have on each emitter)

Each of these has different lifetime cycles, that can be configured to work together or independently…

Stopping the system does not kill emitters unless you configure for doing it on the niagara asset:

  • Emitters with lifetime attached to system will be killed when system is stopped
  • Emitters with Infinite lifetime will keep running even with system being stopped
  • Emitters with Finite lifetime will continue running after system is stopped, until the emitter lifetime itself expires

Same for particles, they will only be removed if you explicitly coded for it on the niagara asset:

  • Particles with infinite lifetime will stay rendered after the emitter lifetime ended
  • Particles with finite lifetime will wait until the lifetime completes before getting removed
  • Particles with lifetime attached to other condition (ex emitter, system or other variable), will follow that condition rules to be removed from scene

This means, calling Stop() on the system, will stop only the system, and chained behavior will depend on how your particle is set up.

For example, these are two emitters, one with the lifetime set as “system” (will be killed when system gets killed):


This one is set to “self” (lifetime independent from the system), set to run only once, and having a lifetime of ~10 seconds:


Also, the system itself also have other configs related to lifetime that need to be considered, like here:


image


Can you check how your particle system is configured, to see if it matches the intendeed behavior to support the functionality you want to achieve?

1 Like

I am sure that the component should not distinguish between different systems within Niagara and should stop rendering when the component is disabled

From what I remember from my tests back when it released, the Enabled/Disabled states of the particle_system_component only controls the AutoPlay and the Start()/Stop() functionality, and not controlling the system lifetime itself. (For example, calling Start() or Stop() while component is disabled do nothing, and the AutoPlay being to auto-fire the Start()/Stop() when enabling/disabling the component for ease-of-use).
If it worked different from this, would not make much sense existing both Enable/Disable and Start/Stop functions since they would be basically the same functionality and also would limit the particle behavior different from what the VFX artist planned…

Then, the actual niagara system and emitters being controled by their proper lifetimes as the user set up on the system (like on my past message), and the Start()/Stop() functions controlling only the system lifetime, while all emitters and particles being chained on the particle definition.
It would not make much sense you configuring it to do something, and afterwards it ignoring your configuration for no reason, specially the lifetime chain, which is very important for the niagara simulation, defining all the particle behaviors and visuals for the specific usages needed…

I will make a new test setup later to check and confirm all the behaviors, the particle_system_component had changes on the past (like mesh_component also had), so I am unsure how the current behavior is, I never needed to do much complex niagara setups with all these functionality yet… (All my systems are basically “kill all” to be enabled/disabled)

I think if you want to force a de-render ignoring the particle system asset configuration, you can just remove the particle system component itself from the entity, that would act as a kill-switch

FORT-971961 changed to ‘Needs More Info’. We’re missing information that would help us determine the source of the issue.