Replicating Niagara Component Attached to Skeletal Mesh of an Actor? Interesting Issue!

isikdev
Sat, 07 May 2022 16:12:32 +0000
Multiplayer & Networking

Hi there, I’m trying to make a laser gun using a niagara component attached to my weapon placeholder in my character BP. Everythings works as intended in singleplayer but if I try to replicate the laser it starts acting weird.

First of all, here is how I set everything up in my character BP:

HeldObjectRoot (component replicates - off)
SkeletalMesh (this is where the weapon is placed, component replicates - off)
LaserFX & LaserHitFX (component replicates - on)

Now I think I do not need to turn on replication for the other components since I have 6 more guns that are working correctly using the same logic, in multiplayer.

This makes me come down to the Niagara components. I think this is where the issue happens, probably because of how I am handling the laser activation/deactivation + my line trace.

Here is how I do it, onLeftMouseBtnClick:

To give some context, first part does not matter since it is only for client ammo updating on my UI. However, normally the linetrace was directly connected after the UpdateAmmo event, and that caused the client to not see the laser when firing. So I decided to do it on Multicast and it works, both can see their lasers and each others’ lasers, but there is a slight issue that I do not understand.

If the Client moves their laser up/down it displays correctly on the Server and itself. However if the Server moves their laser up/down, it displays incorrectly for the Client however correct for itself. Here is a video demonstration of the issue I’m facing:

https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/0/f/e0fb4243edcfdec59efdee2c840fd81694b15798.mp4

I would really appreciate any help. I tried setting component replicates on the other components however that didn’t help, so I’m guessing it’s the way I’m doing it in the event. Where am I wrong here? Thanks for any help!

2 posts - 1 participant