So I have been working on a multiplayer inventory system with limited success. I have a base pickup up class that works just time as long as it is added before runtime. When spawning the actor (i.e. item is discarded from inventory) I no longer get the same result. Maybe someone could point me in the right direction or tell me what I am doing wrong.
when you spawn the actor on clients (Event Rpc set to Multicast), it will spawn on the server AND all clients.
since you call the Destroy Actor only in the server, the client versions will stay…
you need to spawn your actor on the server, and have it being replicated (and all of its compoments,too)… so it will spawn automatically on the clients, too. No need for multicast.
and when you destroy it on the server side, it will get destroyed on all clients, too.
additionally… when spawned on the server, link the playercontroller of the server as owner in th SpawnActorFromClass. This makes sure the server is the owner of this Actor, not the first interacting Client.
Thank you for you response.
The actor (BP_Pickup) is set to replicated but when I change the RPC to run on server the actor is only spawned on the server. I had tried a bunch of different methods and multicast was the only way I was able to see the actor on both the server and clients.
EDIT
I feel so stupid… the mesh was not set to replicate. Thank you so much! I am able to spawn the item from both client and server running the Run on Server RPC.