RPCs vs Properties
Last updated
Was this helpful?
Last updated
Was this helpful?
RPCs are usually used to replicate non-critical (often visual/cosmetic) events. In contrast, Network Properties are used to replicate critical gameplay state.
Network Properties are best when you have a variable that is constantly changing and whose exact value matters for the duration of the game, because properties will eventually replicate to everyone.
Example: a health property.
On the other hand, RPCs are only relevant at the time of their execution, meaning anyone joining after that will never know anything about any RPCs before it.
Example: a damage effect event.
If an event happens infrequently and is merely visual (doesn’t affect gameplay, for example, a sound effect event) it might be more appropriate to use a Remote Procedure Call (RPC) for it.
Often you can evade using RPCs even for events, and that’s by using a using [OnChanged] attribute.