Download

Holding object in multiplayer

Hello,

I’ve been working on a small multiplayer project in which I have a weapon which you can use to hold objects.
However I’ve walked into the problem that I don’t know how to manage it for multiple clients.

APlayerCameraManager* cm = UGameplayStatics::GetPlayerCameraManager(WeaponOwner->GetWorld(), 0);
This line of code essentially assigns which player holds the object since the index given here is 0 client 0 always holds the object
if I change the index to 1 only the second client can hold the object and so on.
I’ve also read that player index “is only for local multiplayer”.
So how can I optimise this line of code for online multiplayer?

Thanks in advance,

InSaine.