Description
ServerRPCs are not executed if called by a server-only instance of the game. This creates a difference in how the game behaves when played as Host vs when played as server-only.
As Host mode is convenient for testing quicker, developers might not realize that the server-only version of the game would not work as expected until they release it.
The lack of errors/warnings makes it hard to debug this, causing frustration.
Reproduce Steps
- Create a script with this code
public class NonPlayerNetworkedObject : NetworkBehaviour
{
public override void OnNetworkSpawn()
{
if (IsServer)
{
Debug.Log("On server and calling serverrpc...");
MyServerRpc();
}
}
[ServerRpc]
void MyServerRpc()
{
Debug.Log("This is the server rpc");
}
}
- Add it to a non-player, networked GameObject

- Add the object to the list of spawnable objects in the NetworkManager (
NetworkPrefabs)
- Start the game as host
- Spawn the object
- See how both logs appear in the console
- Restart the game as server-only
- Spawn the object
- See how only the log from OnNetworkSpawn is visible (MyServerRpc does not get executed)
Actual Outcome
MyServerRpc is not executed when called by a server-only instance of the game
Expected Outcome
MyServerRpc should be executed when called by a server-only instance of the game. Alternatively, a warning/error log should be printed to warn users about what's happening, so that they can refactor their code to ensure it behaves the same in both circumstances.
Environment
- OS: Windows
- Unity Version: 2021.3.12f1
- Netcode Version: 1.1.0
- Netcode Commit: n/a (unable to get it as this version of NGO is pulled in as a dependency of com.unity.multiplayer.samples.coop 1.4.1)
Additional Context
Discord discussion [here](https://discord.com/channels/449263083769036810/819614943723913246/1045346065387356200
Description
ServerRPCs are not executed if called by a server-only instance of the game. This creates a difference in how the game behaves when played as Host vs when played as server-only.
As Host mode is convenient for testing quicker, developers might not realize that the server-only version of the game would not work as expected until they release it.
The lack of errors/warnings makes it hard to debug this, causing frustration.
Reproduce Steps
NetworkPrefabs)Actual Outcome
MyServerRpcis not executed when called by a server-only instance of the gameExpected Outcome
MyServerRpcshould be executed when called by a server-only instance of the game. Alternatively, a warning/error log should be printed to warn users about what's happening, so that they can refactor their code to ensure it behaves the same in both circumstances.Environment
Additional Context
Discord discussion [here](https://discord.com/channels/449263083769036810/819614943723913246/1045346065387356200