RPC migration and compatibility
This section provides information on compatibility and support for Unity Netcode for GameObjects (Netcode) features compared to previous Netcode versions. See the Release Notes for more information.
#
Cross-CompatibilityLearn more about standard RPC API's cross-compatibility only, not the framework as a whole. A method marked as RPC will be statically registered with its assembly-scoped method signature hash.
A typical assembly-scoped method signature sample:
where:
Game.dll
is the Assembly/
is a SeparatorSystem.Void Shooter::PingServerRpc(System.Int32,MLAPI.Messaging.ServerRpcParams)
is the Method signature:System.Void
is the Return typeShooter
is the Enclosing type::
is the Scope resolution operatorPingServerRpc
is the Method name(System.Int32,MLAPI.Messaging.ServerRpcParams)
is the Params with types (no param names)
An RPC signature will be turned into a 32-bit integer using xxHash (XXH32) non-cryptographic hash algorithm.
As expected, RPC signature therefore its hash will be changed if assembly, return type, enclosing type, method name and/or any method param type changes. Names of method parameters can be changed as they are not a part of the method signature.
A change in the RPC signature will lead into a different send/receive codepath with different serialization code and execute a different method body. Previous versions of the RPC method will not be executed by the new RPC method with the new signature.
Compatibility | Description | |
---|---|---|
Cross-Build Compatibility | As long as the RPC method signature is kept the same, it will be compatible between different builds. | |
Cross-Version Compatibility | As long as the RPC method signature is kept the same, it will be compatible between different versions. | |
Cross-Project Compatibility | Since project name or any project-specific token is not being a part of RPC signature, it is possible to have the exact same RPC method signature defined in different builds and they are not necessarily going to be compatible with each other. |
#
Deprecation of return valuesNetcode supports RPC return values on convenience RPCs.
Example:
To achieve similar functionality, use the following: