Unity-Technologies / com.unity.netcode.gameobjects

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.15k stars 435 forks source link

Netcode 2.0, Unity 6 [DestinationState To Transition Info] Layer (0)] #3107

Open careless10 opened 1 month ago

careless10 commented 1 month ago

I am facing this issue on Netcode 2.0 on Unity 6, i know there is a similar existing issue which was closed, but it was on different version so this might be a different problem, At first i thought its related to to blend tree but even simple 2 animations cause this issue, i am trying to use the starter assets third person controller, and OwnerNetworkAnimator as per https://docs-multiplayer.unity3d.com/netcode/current/components/networkanimator/#owner-authoritative-mode no animation is synced at all, but when i try to trigger any transition it crashes giving me this error,

[Netcode] [DestinationState To Transition Info] Layer (0) does not exist! UnityEngine.Debug:LogError (object) Unity.Netcode.NetworkLog:LogError (string) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Logging/NetworkLog.cs:34) Unity.Netcode.Components.NetworkAnimator:UpdateAnimationState (Unity.Netcode.Components.NetworkAnimator/AnimationState) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Components/NetworkAnimator.cs:1235) Unity.Netcode.Components.NetworkAnimator:ProcessAnimStates (Unity.Netcode.Components.NetworkAnimator/AnimationMessage) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Components/NetworkAnimator.cs:1383) Unity.Netcode.Components.NetworkAnimator:SendAnimStateClientRpc (Unity.Netcode.Components.NetworkAnimator/AnimationMessage,Unity.Netcode.ClientRpcParams) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Components/NetworkAnimator.cs:1356) Unity.Netcode.Components.NetworkAnimator:rpc_handler_717942772 (Unity.Netcode.NetworkBehaviour,Unity.Netcode.FastBufferReader,Unity.Netcode.RpcParams) Unity.Netcode.RpcMessageHelpers:Handle (Unity.Netcode.NetworkContext&,Unity.Netcode.RpcMetadata&,Unity.Netcode.FastBufferReader&,Unity.Netcode.RpcParams&) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs:75) Unity.Netcode.ClientRpcMessage:Handle (Unity.Netcode.NetworkContext&) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs:168) Unity.Netcode.NetworkMessageManager:ReceiveMessage (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.NetworkMessageManager) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs:585) Unity.Netcode.NetworkMessageManager:HandleMessage (Unity.Netcode.NetworkMessageHeader&,Unity.Netcode.FastBufferReader,ulong,single,int) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs:444) Unity.Netcode.NetworkMessageManager:ProcessIncomingMessageQueue () (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs:470) Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs:288) Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Core/NetworkUpdateLoop.cs:191) Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:b0_0 () (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Core/NetworkUpdateLoop.cs:214)

uploaded a project that reproduces the issue https://github.com/careless10/Hello-Multiplayer-World use the "Multiplayer Play Mode" add a Player 2 and try it out (try jumping for example),

sadly reverting back to unity 2022.3f for now which works nicely

NoelStephensUnity commented 1 month ago

Hi @careless10,

Attached are some updates to your project. Copy the contents of this zip into your already existing project's folder and it should provide you with the adjustments required to get the ThirdpersonController working properly. Updates_Thirdperson.zip

Let me know how this works for you?

careless10 commented 1 month ago

Thanks alot for replying @NoelStephensUnity i tried it it works for walking + idle, but the moment i jump it still gives the same error [Netcode] [DestinationState To Transition Info] Layer (0) does not exist! UnityEngine.Debug:LogError (object) Unity.Netcode.NetworkLog:LogError (string) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Logging/NetworkLog.cs:34) Unity.Netcode.Components.NetworkAnimator:UpdateAnimationState (Unity.Netcode.Components.NetworkAnimator/AnimationState) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Components/NetworkAnimator.cs:1406) Unity.Netcode.Components.NetworkAnimator:SendAnimStateServerRpc (Unity.Netcode.Components.NetworkAnimator/AnimationMessage,Unity.Netcode.ServerRpcParams) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Components/NetworkAnimator.cs:1532) Unity.Netcode.Components.NetworkAnimator:__rpc_handler_2294987943 (Unity.Netcode.NetworkBehaviour,Unity.Netcode.FastBufferReader,Unity.Netcode.__RpcParams) Unity.Netcode.RpcMessageHelpers:Handle (Unity.Netcode.NetworkContext&,Unity.Netcode.RpcMetadata&,Unity.Netcode.FastBufferReader&,Unity.Netcode.__RpcParams&) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs:75) Unity.Netcode.ServerRpcMessage:Handle (Unity.Netcode.NetworkContext&) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs:132) Unity.Netcode.NetworkMessageManager:ReceiveMessage<Unity.Netcode.ServerRpcMessage> (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.NetworkMessageManager) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs:585) Unity.Netcode.NetworkMessageManager:HandleMessage (Unity.Netcode.NetworkMessageHeader&,Unity.Netcode.FastBufferReader,ulong,single,int) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs:444) Unity.Netcode.NetworkMessageManager:ProcessIncomingMessageQueue () (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs:470) Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs:288) Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Core/NetworkUpdateLoop.cs:191) Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:<CreateLoopSystem>b__0_0 () (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Core/NetworkUpdateLoop.cs:214) i didn't catch all your changes in the code i saw new stuff like networkupdate stage , will look into the documentation later to understand it, but as for now this issue still exists, if anything can be done from my side to speed up the process please let me know

NoelStephensUnity commented 4 weeks ago

@careless10 As long as the player is still jumping then that is a "falsely reported" error message.

Go ahead and make this adjustment to your com.unity.netcode.gameobjects entry in your Packages/manifest.json file:

"com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#fix/player-removed-from-ovservers-when-player-ojbect-despawns",

That includes a fix in #3110 for that false error message as well it includes some additional player observer fixes. It should be merged into the develop-2.0.0 branch sometime today which you could then use:

"com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#develop-2.0.0",

until these fixes make it into the next NGO v2 release.