Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Unity Multiplayer [Netcode] NetworkBehaviour-"prefab" is being destroyed while NetworkObject-"prefab" is still spawned

Discussion in 'Multiplayer' started by elzbeb, Jan 9, 2023.

  1. elzbeb

    elzbeb

    Joined:
    Jul 30, 2020
    Posts:
    54
    Hey so here is the full warning message

    [Netcode] NetworkBehaviour-PlayerArmature(Clone) is being destroyed while NetworkObject-PlayerArmature(Clone) is still spawned! (could break state synchronization)
    0x00007ff77f5e6edd (Unity) StackWalker::GetCurrentCallstack
    0x00007ff77f5edbd9 (Unity) StackWalker::ShowCallstack
    0x00007ff780590f53 (Unity) GetStacktrace
    0x00007ff780c43a53 (Unity) DebugStringToFile
    0x00007ff77e656fa6 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    0x000002e7922fb693 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    0x000002e7922fb5ab (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    0x000002e7923033f0 (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
    0x000002e7d667e5a8 (Mono JIT Code) UnityEngine.Debug:LogWarning (object)
    0x000002e7d667e54b (Mono JIT Code) [NetworkLog.cs:28] Unity.Netcode.NetworkLog:LogWarning (string)
    0x000002e7d667e48b (Mono JIT Code) [NetworkObject.cs:1344] Unity.Netcode.NetworkObject:OnNetworkBehaviourDestroyed (Unity.Netcode.NetworkBehaviour)
    0x000002e7d667e23b (Mono JIT Code) [NetworkBehaviour.cs:850] Unity.Netcode.NetworkBehaviour:OnDestroy ()
    0x000002e792f8fe08 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x00007ffb2a0802f4 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono_jit_runtime_invoke
    0x00007ffb29fbeb34 (mono-2.0-bdwgc) [object.c:3066] do_runtime_invoke
    0x00007ffb29fbeccc (mono-2.0-bdwgc) [object.c:3113] mono_runtime_invoke
    0x00007ff77f50b464 (Unity) scripting_method_invoke
    0x00007ff77f4eadb4 (Unity) ScriptingInvocation::Invoke
    0x00007ff77f4eae9e (Unity) ScriptingInvocation::InvokeChecked
    0x00007ff77f5802e6 (Unity) SerializableManagedRef::CallMethod
    0x00007ff77f4e519b (Unity) MonoBehaviour::WillDestroyComponent
    0x00007ff77ee8b031 (Unity) GameObject::WillDestroyGameObject
    0x00007ff77f1a0fb5 (Unity) PreDestroyRecursive
    0x00007ff77f19eed4 (Unity) DestroyObjectHighLevel_Internal
    0x00007ff77f19eae4 (Unity) DestroyObjectHighLevel
    0x00007ff77efb557b (Unity) DelayedDestroyCallback
    0x00007ff77efb7514 (Unity) DelayedCallManager::Update
    0x00007ff77f1ce749 (Unity) `InitPlayerLoopCallbacks'::`2'::UpdateScriptRunDelayedDynamicFrameRateRegistrator::Forward
    0x00007ff77f1b526a (Unity) ExecutePlayerLoop
    0x00007ff77f1b53f6 (Unity) ExecutePlayerLoop
    0x00007ff77f1bb340 (Unity) PlayerLoop
    0x00007ff78013327f (Unity) PlayerLoopController::UpdateScene
    0x00007ff780131482 (Unity) Application::TickTimer
    0x00007ff780596baa (Unity) MainMessageLoop
    0x00007ff78059b9b4 (Unity) WinMain
    0x00007ff78190464e (Unity) __scrt_common_main_seh
    0x00007ffb969226bd (KERNEL32) BaseThreadInitThunk
    0x00007ffb9824dfb8 (ntdll) RtlUserThreadStart


    I am getting this warning when a client leaves the lobby (host still connected), because of this the client is unable to rejoin back the game unless the host leaves and creates a new session. I followed this video to create an auto join functionality instead of the code method.

    For any further info needed please let me know.