[LogError] NetworkPrefab hash was not found!

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?

Do you call DontDestroyOnLoad(gameObject) for each of the network objects?

1 Like

Yes, I do. I need to have network objects that don’t get destroyed. Is there any work around it?

anyone?

I wouldn’t like to guess at the problem but I’d recommend trying to reproduce it in a small test project. That way even if you’re still none the wiser it would be easier to share for others to look at.

1 Like

It can be reproduced in a new project:

  • Create a new GameObject with a networkbehavior and a network object component.
  • Add a DontDestroyOnLoad script to that GameObj
  • Connect your client to the host
  • Finally, you call the following on the client side:
var netMan = NetworkManager.Singleton;
            if (netMan != null && netMan.ShutdownInProgress == false)
            {
                netMan.Shutdown();
            }
  • and
public void StartClient()
        {
            SetTransportConnectionData(NetcodeUtils.TryResolveHostname(ConnectionAddressData.Address));
            SetConnectionPayload();
            NetworkManager.Singleton.StartClient();
      
        }

You will get these pair of errors for each Don’t Destroy On Load script attached to a Network Object (in this case, 1 pair of errors since there’s only 1 network obj). I found that these errors appear to be harmless. Nonetheless, it wouldn’t make a lot of sense not to allow network objects to remain in between scenes.

I’ll give it a go a bit later. :slight_smile:

1 Like

I appreciate it!

PS: I came to the conclusion of these error logs being harmless since they didn’t affect either the gameplay, connection, or reconnection at any point on the many tests I’ve done. But nevertheless, it’d be nice if we could get some confirmation from the NGO developers.

By looking at some internal changelogs, I think this has been solved in NGO 1.3.0 (which at the time of writing isn’t out yet)

2 Likes

@RikuTheFuffs-U Thanks for letting us know!

1 Like

When will it be out?

There’s no official date yet, but I’d say in 3-4 weeks. Could be earlier, could be later.

1 Like

I’m not getting any errors in NGO 1.2.0. Are you switching scenes?

Hmmm, interesting…
No, they stay on the same scene, I’m also using 1.2.0.

Send me over your project files so I we’re on the same page. You can export them with Assets → Export Package…

1 Like

I’m afraid the package will be too extensive (also there might contain files I might not be able to share). Anyway, it’s all good if it gets fixed on the 1.3.0 version. In the meanwhile, I don’t think it’s a big deal to get those error logs as long as they don’t affect the gameplay.

Thanks for the help! @cerestorm

PS: I don’t have time as of right now to create a new setup (I deleted the previous one (a very simple version) when I was done doing the testing). If I find time later I will try to recreate it and share the results if I’m able to reproduce it again.