Skip to content

Remote client can send RPC to NetworkObject that has been despawned on host, resulting in error #3007

@zachstronaut

Description

@zachstronaut

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

Metadata

Metadata

Labels

priority:highThis issue has high priority and we are focusing to resolve itstat:importedStatus - Issue is tracked internally at Unitytype:bugBug Report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions