[SOLVED]In-Scene placed NetworkObjects are not working.

SOLVED - some kind of project corruption going on

I can't locally join a host, when there is a NetworkObject with a NetworkTransform attached on the scene. It works fine when the NetworkObject doesn't have a NetworkTransform attached. Real-time spawned NetworkObjects work fine too.

As an attempt at fix, I tried making the in-scene placed object a prefab, as well as adding it to NetworkManager prefabslist, but it didn't help, nor is it necessary as per documentation.

When NetworkTransform from the NetworkObject is removed, then I can join again. The errors that are thrown don't seem to be informative or even pointing towards this being an issue either.

Environment:

  • Unity Version: 2023.3.10f1
  • Netcode for GameObjects Version: 1.6.0
  • Unity Transport Version: 2.1.0

Steps to Reproduce:

  • New scene
  • Create a Cube, slap a NetworkObject on it. Add NetworkTransform to it.
  • Host and try to connect with the build or vice-versa.

Expected Behavior: Client joins the host
Actual Behavior: Throws an error, client player doesn't spawn.

[Netcode] Failed to spawn NetworkObject for Hash 687865857.
0x00007ff6ef33282d (Unity) StackWalker::GetCurrentCallstack
0x00007ff6ef3377d9 (Unity) StackWalker::ShowCallstack
0x00007ff6f0307831 (Unity) GetStacktrace
0x00007ff6f09c5d52 (Unity) DebugStringToFile
0x00007ff6ee266db6 (Unity) DebugLogHandler_CUSTOM_Internal_Log
0x000002b8a4b25fca (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
0x000002b8a4b25e3b (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
0x000002b8a4b252be (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
0x000002b8e853fa3a (Mono JIT Code) UnityEngine.Debug:LogError (object)
0x000002b8e855a213 (Mono JIT Code) Unity.Netcode.NetworkLog:LogError (string) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Logging/NetworkLog.cs:34)
0x000002b8e8eeda9b (Mono JIT Code) Unity.Netcode.NetworkObject:AddSceneObject (Unity.Netcode.NetworkObject/SceneObject&,Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkManager) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Core/NetworkObject.cs:1552)
0x000002b8e8eebd6b (Mono JIT Code) Unity.Netcode.SceneEventData:SynchronizeSceneNetworkObjects (Unity.Netcode.NetworkManager) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/SceneEventData.cs:933)
0x000002b8e8ed6c8b (Mono JIT Code) Unity.Netcode.NetworkSceneManager:HandleClientSceneEvent (uint) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/NetworkSceneManager.cs:2048)
0x000002b8e8edbd73 (Mono JIT Code) Unity.Netcode.NetworkSceneManager:ClientLoadedSynchronization (uint) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/NetworkSceneManager.cs:1944)
0x000002b8e8ed9ba3 (Mono JIT Code) Unity.Netcode.NetworkSceneManager:OnClientBeginSync (uint) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/NetworkSceneManager.cs:1872)
0x000002b8e8ed6883 (Mono JIT Code) Unity.Netcode.NetworkSceneManager:HandleClientSceneEvent (uint) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/NetworkSceneManager.cs:2030)
0x000002b8e8e9fc13 (Mono JIT Code) Unity.Netcode.NetworkSceneManager:HandleSceneEvent (ulong,Unity.Netcode.FastBufferReader) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/NetworkSceneManager.cs:2268)
0x000002b8e8eafc7b (Mono JIT Code) Unity.Netcode.SceneEventMessage:Handle (Unity.Netcode.NetworkContext&) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Messaging/Messages/SceneEventMessage.cs:26)
0x000002b8e8ecfcf3 (Mono JIT Code) Unity.Netcode.NetworkMessageManager:ReceiveMessage<Unity.Netcode.SceneEventMessage> (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.NetworkMessageManager) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Messaging/NetworkMessageManager.cs:567)
0x000002b8e8ec380f (Mono JIT Code) (wrapper delegate-invoke) <Module>:invoke_void_FastBufferReader_NetworkContext&_NetworkMessageManager (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.NetworkMessageManager)
0x000002b8e8ec0aae (Mono JIT Code) Unity.Netcode.NetworkMessageManager:HandleMessage (Unity.Netcode.NetworkMessageHeader&,Unity.Netcode.FastBufferReader,ulong,single,int) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Messaging/NetworkMessageManager.cs:432)
0x000002b8e8e6b7e3 (Mono JIT Code) Unity.Netcode.NetworkMessageManager:ProcessIncomingMessageQueue () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Messaging/NetworkMessageManager.cs:458)
0x000002b8e8e65203 (Mono JIT Code) Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Core/NetworkManager.cs:42)
0x000002b8a4be9aac (Mono JIT Code) Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Core/NetworkUpdateLoop.cs:185)
0x000002b8a4c220f3 (Mono JIT Code) Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:<CreateLoopSystem>b__0_0 () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Core/NetworkUpdateLoop.cs:208)
0x000002b8a591bc58 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ff99966e274 (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ff9995aeb74 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066)
0x00007ff9995aed0c (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3113)
0x00007ff6ef249d14 (Unity) scripting_method_invoke
0x00007ff6ef227e34 (Unity) ScriptingInvocation::Invoke
0x00007ff6eeec3728 (Unity) ExecutePlayerLoop
0x00007ff6eeec3748 (Unity) ExecutePlayerLoop
0x00007ff6eeeca025 (Unity) PlayerLoop
0x00007ff6efe8c16f (Unity) PlayerLoopController::InternalUpdateScene
0x00007ff6efe98d9d (Unity) PlayerLoopController::UpdateSceneIfNeededFromMainLoop
0x00007ff6efe970a1 (Unity) Application::TickTimer
0x00007ff6f030e16a (Unity) MainMessageLoop
0x00007ff6f03139d0 (Unity) WinMain
0x00007ff6f16f7dbe (Unity) __scrt_common_main_seh
0x00007ff9d5fb7034 (KERNEL32) BaseThreadInitThunk
0x00007ff9d77c26a1 (ntdll) RtlUserThreadStart
OverflowException: Reading past the end of the buffer
Unity.Netcode.FastBufferReader.ReadBytesSafe (System.Byte* value, System.Int32 size, System.Int32 offset) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Serialization/FastBufferReader.cs:715)
Unity.Netcode.FastBufferReader.ReadUnmanagedSafe[T] (T& value) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Serialization/FastBufferReader.cs:769)
Unity.Netcode.FastBufferReader.ReadValueSafe[T] (T& value, Unity.Netcode.FastBufferWriter+ForPrimitives unused) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Serialization/FastBufferReader.cs:1108)
Unity.Netcode.NetworkObject+SceneObject.Deserialize (Unity.Netcode.FastBufferReader reader) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Core/NetworkObject.cs:1336)
Unity.Netcode.SceneEventData.SynchronizeSceneNetworkObjects (Unity.Netcode.NetworkManager networkManager) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/SceneEventData.cs:926)
Unity.Netcode.NetworkSceneManager.HandleClientSceneEvent (System.UInt32 sceneEventId) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/NetworkSceneManager.cs:2048)
Unity.Netcode.NetworkSceneManager.ClientLoadedSynchronization (System.UInt32 sceneEventId) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/NetworkSceneManager.cs:1944)
Unity.Netcode.NetworkSceneManager.OnClientBeginSync (System.UInt32 sceneEventId) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/NetworkSceneManager.cs:1872)
Unity.Netcode.NetworkSceneManager.HandleClientSceneEvent (System.UInt32 sceneEventId) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/NetworkSceneManager.cs:2030)
Unity.Netcode.NetworkSceneManager.HandleSceneEvent (System.UInt64 clientId, Unity.Netcode.FastBufferReader reader) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/SceneManagement/NetworkSceneManager.cs:2268)
Unity.Netcode.SceneEventMessage.Handle (Unity.Netcode.NetworkContext& context) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Messaging/Messages/SceneEventMessage.cs:26)
Unity.Netcode.NetworkMessageManager.ReceiveMessage[T] (Unity.Netcode.FastBufferReader reader, Unity.Netcode.NetworkContext& context, Unity.Netcode.NetworkMessageManager manager) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Messaging/NetworkMessageManager.cs:567)
Unity.Netcode.NetworkMessageManager.HandleMessage (Unity.Netcode.NetworkMessageHeader& header, Unity.Netcode.FastBufferReader reader, System.UInt64 senderId, System.Single timestamp, System.Int32 serializedHeaderSize) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Messaging/NetworkMessageManager.cs:432)
UnityEngine.Debug:LogException(Exception)
Unity.Netcode.NetworkMessageManager:HandleMessage(NetworkMessageHeader&, FastBufferReader, UInt64, Single, Int32) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Messaging/NetworkMessageManager.cs:436)
Unity.Netcode.NetworkMessageManager:ProcessIncomingMessageQueue() (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Messaging/NetworkMessageManager.cs:458)
Unity.Netcode.NetworkManager:NetworkUpdate(NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Core/NetworkManager.cs:42)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage(NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Core/NetworkUpdateLoop.cs:185)
Unity.Netcode.<>c:<CreateLoopSystem>b__0_0() (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Core/NetworkUpdateLoop.cs:208)

I tried this with Unity 2023.1.17f1, Netcode 1.6.0 and Unity Transport 2.1.0 and I'm not seeing the issue, only the host was a build and the client run in the editor.

Seems to be some kind of incompatibility on my end, as it works in a fresh project.