-
Notifications
You must be signed in to change notification settings - Fork 464
Description
Remote client can send RPC to NetworkObject that has been despawned on host, resulting in error in ProxyMessage on the host when the RPC is received:
InvalidOperationException: An RPC called on a NetworkObject that is not in the spawned objects list. Please make sure the NetworkObject is spawned before calling RPCs.
Define your RPC like this and call it on the client:
[Rpc(SendTo.Everyone, RequireOwnership = false)]
void MyRpc() {}
Despawn the same NetworkObject on the host:
myNetObject.Despawn();
Depending on (I assume) message timing and latency, you can get your RPC message from the client to arrive on the host after the network object has despawned there, and then you get the error.
However, the remote client will not have called any OnNetworkDespawn methods yet so it has no way of knowing this will happen, and so I'm not sure how to prevent it?
Netcode 1.9.1