Events / Functions Replication Questions

Hi guys , so I’m trying to understand how events replication works , here are my questions :
1 - how does run on server and Multicast and run on client actually work
2 - the node switch has authority what does it actually do .
3 - also the nodes ( is locally controller AND Force net update ) what to they do .
4 - what is the best way to spawn an actor and attach it to player and also detach it from player .

Thank You

  • RunOnServer

When called checks if the caller is set as the Owner of the actor. It makes a query for the actors most outer owner and if it is the same PlayerController owner that made the call then it will proceed with the RPC (Remote Procedure Call).

  • Multicast

When called checks if the caller is the Server and if it is then it broadcasts the RPC to every player.

  • RunOnOwningClient

When called checks if the caller is the Server and proceeds with the RPC to the Owner if it has any.

SwitchHasAuthority is used to check if the network event is happening on the device with Authority (Server) or without (Client).

IsLocallyControlled is used to check if the Actor is being controlled by a local Controller. If false you can assume it is being controlled by another player on the network.
ForceNetUpdate can be used to wake up a dormant Actor to ensure the Net Update happens on the next update.

Replicated Actors should be Spawned, Attached and Detached by the Server. Note that any attached actors also needs to be replicated.
This is a very simplified explanation so beware of the many pitfalls when dealing with networking. Keep an eye on the Actor Replication flag and any warning in the log especially ones dealing with dropped Remote Procedure Calls.

So another question some times when I attach and item to an actor , it works fine on the server but on the client it apply this event only for the server and somtimes for the server and the client , if I wanted an event to happen only on the client and the server doesn’t apply it just knows that that client did somthing and just notify all other client , what should I do .

Could you show how you are attaching and moving the Actors?