I’m trying to get a reconnection for clients that have been AFK for a few seconds and therefore lost connection. In order to do so, I’m just shutting the network via:
var netMan = NetworkManager.Singleton;
if (netMan != null && netMan.ShutdownInProgress == false)
{
netMan.Shutdown();
}
And then perform a regular connection:
public void StartClient()
{
SetTransportConnectionData(NetcodeUtils.TryResolveHostname(ConnectionAddressData.Address));
SetConnectionPayload();
NetworkManager.Singleton.StartClient();
}
Then, I elaborated some code where clients get all the information needed from the host and update their game status as soon as they reconnect. And it works fine and dandy, except for these errors that I’m getting:
There are 7 pairs of these. The following are the full ErrorLog for one of the seven pairs:
ErrorLog 1
[Netcode] NetworkPrefab hash was not found! In-Scene placed NetworkObject soft synchronization failure for Hash: 4028500965!
UnityEngine.Debug:LogError (object)
Unity.Netcode.NetworkLog:LogError (string) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Logging/NetworkLog.cs:34)
Unity.Netcode.NetworkSpawnManager:CreateLocalNetworkObject (Unity.Netcode.NetworkObject/SceneObject) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Spawning/NetworkSpawnManager.cs:394)
Unity.Netcode.NetworkObject:AddSceneObject (Unity.Netcode.NetworkObject/SceneObject&,Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkManager) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkObject.cs:1403)
Unity.Netcode.SceneEventData:SynchronizeSceneNetworkObjects (Unity.Netcode.NetworkManager) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/SceneEventData.cs:877)
Unity.Netcode.NetworkSceneManager:HandleClientSceneEvent (uint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/NetworkSceneManager.cs:1781)
Unity.Netcode.NetworkSceneManager:ClientLoadedSynchronization (uint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/NetworkSceneManager.cs:1747)
Unity.Netcode.NetworkSceneManager:OnClientBeginSync (uint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/NetworkSceneManager.cs:1676)
Unity.Netcode.NetworkSceneManager:HandleClientSceneEvent (uint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/NetworkSceneManager.cs:1774)
Unity.Netcode.NetworkSceneManager:HandleSceneEvent (ulong,Unity.Netcode.FastBufferReader) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/NetworkSceneManager.cs:1961)
Unity.Netcode.SceneEventMessage:Handle (Unity.Netcode.NetworkContext&) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Messaging/Messages/SceneEventMessage.cs:26)
Unity.Netcode.MessagingSystem:ReceiveMessage<Unity.Netcode.SceneEventMessage> (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.MessagingSystem) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Messaging/MessagingSystem.cs:511)
Unity.Netcode.MessagingSystem:HandleMessage (Unity.Netcode.MessageHeader&,Unity.Netcode.FastBufferReader,ulong,single,int) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Messaging/MessagingSystem.cs:384)
Unity.Netcode.MessagingSystem:ProcessIncomingMessageQueue () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Messaging/MessagingSystem.cs:404)
Unity.Netcode.NetworkManager:OnNetworkEarlyUpdate () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkManager.cs:1600)
Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkManager.cs:1532)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkUpdateLoop.cs:185)
Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:<CreateLoopSystem>b__0_0 () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkUpdateLoop.cs:208)
and
ErrorLog 2
[Netcode] Failed to spawn NetworkObject for Hash 4028500965.
UnityEngine.Debug:LogError (object)
Unity.Netcode.NetworkLog:LogError (string) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Logging/NetworkLog.cs:34)
Unity.Netcode.NetworkObject:AddSceneObject (Unity.Netcode.NetworkObject/SceneObject&,Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkManager) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkObject.cs:1410)
Unity.Netcode.SceneEventData:SynchronizeSceneNetworkObjects (Unity.Netcode.NetworkManager) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/SceneEventData.cs:877)
Unity.Netcode.NetworkSceneManager:HandleClientSceneEvent (uint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/NetworkSceneManager.cs:1781)
Unity.Netcode.NetworkSceneManager:ClientLoadedSynchronization (uint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/NetworkSceneManager.cs:1747)
Unity.Netcode.NetworkSceneManager:OnClientBeginSync (uint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/NetworkSceneManager.cs:1676)
Unity.Netcode.NetworkSceneManager:HandleClientSceneEvent (uint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/NetworkSceneManager.cs:1774)
Unity.Netcode.NetworkSceneManager:HandleSceneEvent (ulong,Unity.Netcode.FastBufferReader) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/SceneManagement/NetworkSceneManager.cs:1961)
Unity.Netcode.SceneEventMessage:Handle (Unity.Netcode.NetworkContext&) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Messaging/Messages/SceneEventMessage.cs:26)
Unity.Netcode.MessagingSystem:ReceiveMessage<Unity.Netcode.SceneEventMessage> (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.MessagingSystem) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Messaging/MessagingSystem.cs:511)
Unity.Netcode.MessagingSystem:HandleMessage (Unity.Netcode.MessageHeader&,Unity.Netcode.FastBufferReader,ulong,single,int) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Messaging/MessagingSystem.cs:384)
Unity.Netcode.MessagingSystem:ProcessIncomingMessageQueue () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Messaging/MessagingSystem.cs:404)
Unity.Netcode.NetworkManager:OnNetworkEarlyUpdate () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkManager.cs:1600)
Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkManager.cs:1532)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkUpdateLoop.cs:185)
Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:<CreateLoopSystem>b__0_0 () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkUpdateLoop.cs:208)
I’ve done some reading on this kind of ErrorLogs, where people refer to monobehaviours being attached to network objects, but that doesn’t make total sense to me, or having to do with nested prefabs, which I think I don’t have but I don’t understand it completely. What could really be causing this issue? Any bad practice on my part that rings your bell?