Networked scripts mismatch client / host when second player join
Hi everyone!
I'm trying to do a little multiplayer game to learn multiplayer with unet. Everything was fine I was doing check with editor + build in local frequently, and even the option to do it online. Then out of nowhere, I have a bug since few days and I'm becoming crazy right now, I can't even figure out from what is it : I can't connect 2 players together, local or online.
So if I try to join with the second player (from editor or build, local or online I always have the same errors) the player join and is immediately kicked with the message : Network configuration mismatch detected. The number of networked scripts on the client does not match the number of networked scripts on the server. This could be caused by lazy loading of scripts on the client. This warning can be disabled by the checkbox in NetworkManager Script CRC Check. I tried to uncheck this box in NetworkManager, did not change a thing.
On the host side I receive this message : there is already a player at that playerControllerId for this connections.
I tried to use a debug.Log to check the ID of the player that join the server :
public override void OnStartClient()
{
base.OnStartClient();
string _netID = GetComponent<NetworkIdentity>().netId.ToString();
Debug.Log(_netID);
Player _player = GetComponent<Player>();
GameManager.RegisterPlayer(_netID, _player);
}
I also have the following messages in the console when the 2nd player try to join (with the debug that is read twice idk why) :
And idk why but everytime I have this error, I can press "stop" so the client stop trying to join, the I can press "Client" again to join and it work everytime on the second attempt (online or with editor-build).
Finally, when I connect a player alone on the server, then disconnect, then connect his ID will always be like 2, then 4, then6... (or 1, 3, 5 if I delete a GO in the scene with a networkIdentity) :
If anyone can help me it would be soooo nice :'( I found a lot of posts with some of thoses errors but I still can't even find where it is from.
Your answer
Follow this Question
Related Questions
localScale in network 0 Answers
UNET (Multiplayer) calling [command] function twice 0 Answers
[UNET 5.2] Multiple local authority for 1 object? 0 Answers
NetworkServer.Spawn spawns objects differently between clients 0 Answers
Unity Network for RTS 0 Answers