I have an older Unity Unet Game which I build 2 or 3 years ago and forgot about it. Now I wanted to show it to a friend but it does not work anymore. When I start the server as player1 in the editor I can see that player2 can join and no errors (using runtime build) occur in the console but player2 can't play, he seems stuck but I can see him in the hierarchy of the editor.
When I start the server as player1 in the runtime and try to join with player2 in the editor I can see that player2 has a playercontroller-id of -1 a network-id of 0 and also a scene-id of 0.
Is that because Unet is EoL or should it work and I just missed something?
I am using the old version 2018.3.0f2.
I can still see the other player and can kill him but the other player simply seems to not take over the main camera. I have to investigate a bit further.
In the editor I got this error message:
IndexOutOfRangeException: NetworkReader:ReadBytes out of range: (21440) NetBuf sz:41 pos:5
UnityEngine.Networking.NetBuffer.ReadBytes (System.Byte[] buffer, System.UInt32 count) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkBuffer.cs:45)
UnityEngine.Networking.NetworkReader.ReadString () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkReader.cs:305)
Player_Controller.OnDeserialize (UnityEngine.Networking.NetworkReader reader, System.Boolean initialState) (at <811655ab22fa4c9c9e92117581e47a9e>:0)
UnityEngine.Networking.NetworkIdentity.OnUpdateVars (UnityEngine.Networking.NetworkReader reader, System.Boolean initialState, UnityEngine.Networking.NetworkMessage netMsg) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkIdentity.cs:745)
UnityEngine.Networking.ClientScene.ApplySpawnPayload (UnityEngine.Networking.NetworkIdentity uv, UnityEngine.Vector3 position, System.Byte[] payload, UnityEngine.Networking.NetworkInstanceId netId, UnityEngine.GameObject newGameObject, UnityEngine.Networking.NetworkMessage netMsg) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/ClientScene.cs:499)
UnityEngine.Networking.ClientScene.OnObjectSpawn (UnityEngine.Networking.NetworkMessage netMsg) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/ClientScene.cs:560)
UnityEngine.Networking.NetworkConnection.HandleReader (UnityEngine.Networking.NetworkReader reader, System.Int32 receivedSize, System.Int32 channelId) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkConnection.cs:469)
UnityEngine.Networking.NetworkConnection.HandleBytes (System.Byte[] buffer, System.Int32 receivedSize, System.Int32 channelId) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkConnection.cs:425)
UnityEngine.Networking.NetworkConnection.TransportReceive (System.Byte[] bytes, System.Int32 numBytes, System.Int32 channelId) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkConnection.cs:576)
UnityEngine.Networking.NetworkClient.Update () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkClient.cs:754)
UnityEngine.Networking.NetworkClient.UpdateClients () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkClient.cs:966)
UnityEngine.Networking.NetworkIdentity.UNetStaticUpdate () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkIdentity.cs:1086)
Maybe you can explain what that error message says?
I kind of fixed it by adding the following method to my networkbehavior
public override void OnDeserialize(NetworkReader reader, bool initialState)
{
base.OnDeserialize(reader, initialState);
}
But now lots of other bugs occur, when I kill my opponent points are not assigned and so on. Does this happen because of deprecated Unet or am I just too dumb?
I built the game using version 2018.3.11f1 which seems to have some differences to 2018.3.0f2. Using the correct minor version did the trick. I wonder that much has changed between these 2 minor change releases.