UNiagaraDataInterfaceWater bFindClosestBody is unreliable in World Parition

Hi,

We are seeing an issue with the bFindClosestBody flag on UNiagaraDataInterfaceWater. It seems to be unreliable based on the streaming order of the AWaterBody vs the Niagara emitter. The issue seems to be that it doesn’t search for closest water body unless SourceBodyChangeId changes which means that if the water body streams in after it will never find it. It also breaks in other scenarios like if body is a BP and the SCS runs in editor even if bFindClosestBody=false and it’s explicitly set.

Changing the code in UNiagaraDataInterfaceWater::PerInstanceTick to

// Do we need to update the water body component?
	if (InstData->WaterBodyChangeId != SourceBodyChangeId || !InstData->WaterBodyComponent.IsValid()) 

seems to resolve the issue for us since it looks up the weak pointer again and will find it successfully.

We wanted to pass the fix along, or at least let Epic know about the bug.

Thanks!

[Attachment Removed]

Steps to Reproduce
Place a Niagara Emitter using UNiagaraDataInterfaceWater with a null SourceBodyComponent and bFindClosestBody in a World Partition map where both are spatially loaded. Observe that the water body is not always found.

[Attachment Removed]

Hi,

The fix seems reasonable : basically keep searching while there’s no water body. We will integrate this ASAP.

Thanks for letting us know!

Cheers,

[Attachment Removed]

FYI, the fix has been integrated to UE5/Main : https://github.com/EpicGames/UnrealEngine/commit/552377b0756486e65ed3b5e1b7760f64ffcd90c4\.

Thanks again

Cheers,

[Attachment Removed]