Netcode crashing when trying to connect client to host
Using netcode for gameobjects, I'm having a weird problem when trying to connect a client to a host. The client seems unable to even spawn in its player prefab and the game crashes. Here are the errors I get in the console.
I suspect it has something to do with how I setup my components in the player gameobject. I disabled about half of them to see if the issue would go away but no luck. Here's what it currently looks like
The only other things I have in the player are two children. One only for the model and the other is empty to store a transform
I'm assuming you have enabled scene management.
This error throwed on me when I instantiated the network object before starting the server. Netcode considers it a "scene object" since it's been there before netcode started. What happens is when the client connects, it tries to find that "scene" object. However, since the object has been created runtime on the server, it obviously doesn't exist.
The process of linking scene objects is called soft synchronization (soft-sync), and it only works if scene management is enabled.
https://docs-multiplayer.unity3d.com/netcode/current/basics/object-spawning/#soft-synchronization
Again, object on the server is created runtime, but is created before the server is started, so netcode considers it a scene object. Client searches for that object on their instance assuming it's part of a scene, and obviously doesn't find it.