UGameplayStatics::SpawnEmitterAttached crashes on clients

Does anybody know why my following code sometimes (usually after some inactive time) gives a Renderer crash on clients (no issue on Listen Server), more specifically a:

Rendering thread exception:
Assertion failed: UniformBufferRHI.GetReference() [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\RenderCore\Public\UniformBuffer.h] [Line: 87] 
Attempted to access UniformBufferRHI on a TUniformBuffer that was never filled in with anything


0x00007ffb9b63478c KERNELBASE.dll!UnknownFunction []
0x00007ffb1d010216 UE4Editor-Core.dll!UnknownFunction []
0x00007ffb1d014218 UE4Editor-Core.dll!UnknownFunction []
0x00007ffb1cd3242d UE4Editor-Core.dll!UnknownFunction []
0x00007ffb1cc86a45 UE4Editor-Core.dll!UnknownFunction []
0x00007ffb1cc880a0 UE4Editor-Core.dll!UnknownFunction []
0x00007ffac5d604b3 UE4Editor-Engine.dll!UnknownFunction []
0x00007ffac5d58102 UE4Editor-Engine.dll!UnknownFunction []
0x00007ffac5d53803 UE4Editor-Engine.dll!UnknownFunction []
0x00007ffacbac3b1c UE4Editor-Renderer.dll!UnknownFunction []
0x00007ffacbab51c6 UE4Editor-Renderer.dll!UnknownFunction []
0x00007ffacbac8619 UE4Editor-Renderer.dll!UnknownFunction []
0x00007ffacb459339 UE4Editor-Renderer.dll!UnknownFunction []
0x00007ffacba6f875 UE4Editor-Renderer.dll!UnknownFunction []
0x00007ffacba45f8f UE4Editor-Renderer.dll!UnknownFunction []
0x00007ffacba58f6d UE4Editor-Renderer.dll!UnknownFunction []
0x00007ffacba5cd3c UE4Editor-Renderer.dll!UnknownFunction []
0x00007ffb1ca92398 UE4Editor-Core.dll!UnknownFunction []
0x00007ffb1ca927ce UE4Editor-Core.dll!UnknownFunction []
0x00007ffb1c7b9c67 UE4Editor-RenderCore.dll!UnknownFunction []
0x00007ffb1c7c2f34 UE4Editor-RenderCore.dll!UnknownFunction []
0x00007ffb1d02ff0b UE4Editor-Core.dll!UnknownFunction []
0x00007ffb1d027050 UE4Editor-Core.dll!UnknownFunction []
0x00007ffb9cb154e0 KERNEL32.DLL!UnknownFunction []
0x00007ffb9e00485b ntdll.dll!UnknownFunction []
if (IsValid(GetTemplateWeaponData()->MuzzleFlashEffect))
	{
		// Muzzle flash effect.
		UGameplayStatics::SpawnEmitterAttached(
			GetTemplateWeaponData()->MuzzleFlashEffect,
			GetItemMesh_D(),
			GetTemplateWeaponData()->MuzzleSocket,
			FVector::ZeroVector, FRotator::ZeroRotator, FVector::OneVector,
			EAttachLocation::SnapToTargetIncludingScale,
			true,
			EPSCPoolMethod::AutoRelease,
			true);
	}

The code is being run client-side and it happens with different particle systems.

For now, I’m going to try to replace it with a single Emitter since it shouldn’t be an issue in the case of a muzzle flash but there may be other situations where I want to spawn Emitters at run-time.

EDIT: Nevermind, even when using a single emitter and using ActivateSystem, it still causes the crash. Is there something about Particle Systems I am not aware of?

I’ve tried many things to try to fix this but to still no avail.

  • Muzzle Flash effect is now triggered based on a replicated variable and is looped until that replicated variable is false, as opposed to RPCs.
  • I’ve tried adding framerate/time locks on the Muzzle Flash but still crashes.
  • I’ve unlocked the tick rate for the Weapon instead of 0.05s.
  • I’ve tried using Blueprint to trigger the effects.

I don’t understand the correlation between clients and the game crashing because of a Particle System. I originally thought maybe the RPCs were being triggered faster than the game’s framerate (i.e. 2 muzzle flash triggers within one tick), but that’s obviously not the case.

I decided to move to Niagara and it seems that it no longer crashes.