Description
Describe the bug
If there are more than 41 non-player network prefab instances, new clients consistently throw a KeyNotFoundException. The client is left in a broken state. It looks like the player prefab is prevented from spawning due to the exception.
I have tried different ways of creating the objects in the server including manually adding them to the scene and spawning via the NetworkManager. The results are strangely consistent (it always fails at 42 or more objects).
Sample project attached.
To Reproduce
This is a Netcode application. The best way to reproduce the problem is to build it (with Development Build selected) and run two instances of it. There's a simple UI. In one instance, click "Start Host", in the other click "Start Client". You should see the error in the client instance.
I don't know if the number of prefab instances is significant, although I have recreated this problem on two computers.
In the "Root" scene, there's an object called "DynamicObjects" that has a component called "ObjectSpawner". You can change the number of objects spawned in the Inspector.
Environment (please complete the following information):
- OS: Windows 10
- Unity Version: 2021.2.7f1
- Netcode Version: 1.0.0-pre.3
Sample Project
SpawnBug.zip