Description

The BP function calls FNiagaraSystemInstance::SetEmitterEnable, which sets ExecutionState on the emitter instance to ENiagaraExecutionState::Inactive. FNiagaraSystemSimulation::PrepareForSystemSimulate then tries to copy the current execution state before running the system update script, but that will never work:

FNiagaraEmitterInstance& EmitterInst = Emitters[EmitterIdx].Get();
if (EmitterExecutionStateAccessors.Num() > EmitterIdx && EmitterExecutionStateAccessors[EmitterIdx].IsValidForWrite())
{
    EmitterExecutionStateAccessors[EmitterIdx].Set(SystemIndex, (int32)EmitterInst.GetExecutionState());
}

IsValidForWrite() is always false here, because the destination buffers haven't been set up yet. Anyway, even if that worked, we don't want to set the destination value, since it will be overwritten when the update script runs; we want to set the source value, and it's not clear to me how that can be done.

Finally, FNiagaraSystemSimulation::TransferSystemSimResults gets the value that the update script produced and updates the emitter's ExecutionState field with it. The state set from BP is never taken into account.

Steps to Reproduce

1. Open the map /Game/Developers/mihneabalta/DeactivateEmitter in the EngineTest project
2. Play in editor
3. Observe that the fountain emitter produces particles, despite the level blueprint trying to deactivate it on each tick using the SetEmitterEnable function

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-89870 in the post.

0
Login to Vote

Fixed
ComponentUE - Niagara
Affects Versions4.25
Target Fix5.4
Fix Commit27684825
Main Commit11837658
Release Commit11586497
CreatedMar 2, 2020
ResolvedSep 27, 2023
UpdatedOct 4, 2023