Spawning certain prefabs before second client joined, cant connect to that scene

Hey, been trying to figure out go netcode
now i’m struggling connecting with the second client as of a sudden.
I fixed this earlier today by removing and re-adding a networkobject script on one of the spawned prefabs.

So what happens is : two players, one is host and one is client
host starts game (using relay if thats important) and loads the main scene via the network scene manager.
Client joins via join code and that used to work, but only if i dont spawn said prefabs before the client joins.
He can see them and they work fine if i spawn them after he joined.
It works with another set of prefabs, which also get spawned once the host is in that scene.

Now that does not seem to help, besides the warning (yea not error) is not really much of help:
9023941--1244941--nc.png

Here the full text:

Trying to receive TimeSyncMessage from client 0 which is not in a connected state.
UnityEngine.Debug:LogWarning (object)
Unity.Netcode.MessagingSystem:GetMessageVersion (System.Type,ulong,bool) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Messaging/MessagingSystem.cs:504)
Unity.Netcode.MessagingSystem:ReceiveMessage<Unity.Netcode.TimeSyncMessage> (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.MessagingSystem) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Messaging/MessagingSystem.cs:530)
Unity.Netcode.MessagingSystem:HandleMessage (Unity.Netcode.MessageHeader&,Unity.Netcode.FastBufferReader,ulong,single,int) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Messaging/MessagingSystem.cs:416)
Unity.Netcode.MessagingSystem:ProcessIncomingMessageQueue () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Messaging/MessagingSystem.cs:436)
Unity.Netcode.NetworkManager:OnNetworkEarlyUpdate () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Core/NetworkManager.cs:1397)
Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Core/NetworkManager.cs:1329)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Core/NetworkUpdateLoop.cs:185)
Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:<CreateLoopSystem>b__0_0 () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.3.1/Runtime/Core/NetworkUpdateLoop.cs:208)

Edit:
im using 1.3.1 btw and 2022.2.17

i tried 1.4.0 but its same
i also tried 1.1.0 which does not give any warning at all

Its not actually the prefab it seems but the amount.

This code works and both can play on that scene but if i set the x < 11 to x < 12 , it stops working and gives the warning as before.

public override void OnNetworkSpawn()
    {
        base.OnNetworkSpawn();

        if (IsServer)
        {
            for (int x = 0; x < 11; x++)
            {
                GameObject go = Instantiate(plantsPrefab,
                    plantsParent.transform.position + new Vector3(x + 1, 0, 3),
                    Quaternion.identity, plantsParent.transform);
                go.GetComponent<NetworkObject>().Spawn();
            }
        }
    }

I can keep spawning enemies after both joined, added like 20 and it works fine.

Only doesnt work fine if they’re spawned before the client joined.

  1. one hosts(server+client)
  2. join with 2nd client alright
  3. spawn bunch of enemies (works)
  4. join with 3rd client (doesnt work he gets that warning again)
    the 2nd client and host can still play fine though…

any idea how to solve this issue or bug? what is my mistake here?

Hey! I had the same thing happen to me just now. Never had it before, didn’t change anything Netcode related in the last weeks.

When I disabled my VPN (NordVPN) it worked again! Weird thing is that I’ve had the same VPN for ages, and never had issues.

1 Like