Closed
Description
Describe the bug
When spawning an object and then trying to reference that object via an RPC it is possible that the RPC arrives before the object gets spawned. This bug happens because Spawn calls and RPCs use different ReliableSequenced channels internally and thus lose the guarantee of order.
To Reproduce
Steps to reproduce the behavior:
- Spawn an object using
NetworkObject::Spawn
- Invoke a ClientRpc containing the id of the NetworkObject as a parameter immediately after spawning the object on another NetworkObject.
- Have the ClientRpc search for the object with
NetworkSpawnManager.SpawnedObjects[objNetID]
- Error appears in some cases. This is a race condition.
Actual outcome
KeyNotFound Exception is thrown.
Expected outcome
Because RPCs and Spawn calls are in order I'm able to reference my NetworkObject
Environment (please complete the following information):
- OS: any
- Unity Version: any
- MLAPI Version: 0.1.0