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.1k stars 430 forks source link

Network Animator error on Client: [DestinationState To Transition Info] Layer (0) does not exist! #2828

Open marcobethkeskyered opened 4 months ago

marcobethkeskyered commented 4 months ago

Description

(Animations are working and everything but the exception is logged anytime I switch to another animation)

[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@1.8.0/Runtime/Logging/NetworkLog.cs:34) Unity.Netcode.Components.NetworkAnimator:UpdateAnimationState (Unity.Netcode.Components.NetworkAnimator/AnimationState) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.8.0/Components/NetworkAnimator.cs:1180) Unity.Netcode.Components.NetworkAnimator:SendAnimStateClientRpc (Unity.Netcode.Components.NetworkAnimator/AnimationMessage,Unity.Netcode.ClientRpcParams) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.8.0/Components/NetworkAnimator.cs:1292) Unity.Netcode.Components.NetworkAnimator:rpc_handler_1069363937 (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@1.8.0/Runtime/Messaging/Messages/RpcMessages.cs:70) Unity.Netcode.ClientRpcMessage:Handle (Unity.Netcode.NetworkContext&) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.8.0/Runtime/Messaging/Messages/RpcMessages.cs:159) Unity.Netcode.NetworkMessageManager:ReceiveMessage (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.NetworkMessageManager) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.8.0/Runtime/Messaging/NetworkMessageManager.cs:582) Unity.Netcode.NetworkMessageManager:HandleMessage (Unity.Netcode.NetworkMessageHeader&,Unity.Netcode.FastBufferReader,ulong,single,int) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.8.0/Runtime/Messaging/NetworkMessageManager.cs:446) Unity.Netcode.NetworkMessageManager:ProcessIncomingMessageQueue () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.8.0/Runtime/Messaging/NetworkMessageManager.cs:472) Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.8.0/Runtime/Core/NetworkManager.cs:48) Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.8.0/Runtime/Core/NetworkUpdateLoop.cs:185) Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:b0_0 () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.8.0/Runtime/Core/NetworkUpdateLoop.cs:208)

Reproduce Steps

I think its not so hard to reproduce. There are many people having the same issue. Links of others: 1) https://discussions.unity.com/t/netcode-destinationstate-to-transition-info-layer-0-does-not-exist/264321/3 2) https://stackoverflow.com/questions/76636441/weird-error-when-client-connecting-to-host-netcode

Actual Outcome

Whenever I do an attack, the animation error is logged.

Expected Outcome

It would be nice to understad why the errors are logged.

Environment

Additional Context

I have a blend tree for locomotion, but for the attacks I am just switching to an animation state.

morettyCat commented 4 months ago

We are facing the same problem. It's been debugging the info because you probably use a blend tree on your animation, and i don't know why but it's trying to access to a state(0) on that blend tree when an animation end and go from inside the blend tree to outside of it.

It's like you can't use blend tree on animators or you'll have tons of warnings around, which is not so nice :\

colbydane commented 2 months ago

Using ver 1.8.1 issue still exists.

marcobethkeskyered commented 2 months ago

Update:

I am also using Blendtree + ServerAuth = true

NoelStephensUnity commented 2 months ago

This could be an issue with (maybe?) a transition back to no state on Layer 0 and the original design was expecting some form of registered transition.

@marcobethkeskyered @colbydane

Before I go and just remove that error message (i.e. it might be a perfectly valid combination and no reason to log any message), the animations are playing/synchronizing correctly and the issue is just the spam of the message?

ducksplash commented 2 months ago

This could be an issue with (maybe?) a transition back to no state on Layer 0 and the original design was expecting some form of registered transition.

@marcobethkeskyered @colbydane

Before I go and just remove that error message (i.e. it might be a perfectly valid combination and no reason to log any message), the animations are playing/synchronizing correctly and the issue is just the spam of the message?

In my particular case, the animation plays but is not visible to other parties, only the local player.

colbydane commented 2 months ago

For me everything acts as expected, except for the error log.

NoelStephensUnity commented 2 months ago

Generally speaking, that error message is logging because there was some form of transition to Layer 0 with no destination state (or there are no defined Animator transitions from say like Layer 2 to Layer 0 so that table can be built during editor to runtime/entering play mode build/serialization).

@ducksplash Is there any way you could provide a simplified version of your project that includes the assets needed (i.e. the model and Animator) along with the scripts (or a reduced set of the scripts) used to update the Animator (i.e. transition between states etc)?

@colbydane Ok, pending what I find from @ducksplash I might just remove that warning... but don't want to do that just yet until I determine if this error might still be useful. If you possible, providing me with the same kind of assets I am asking ducksplash to provide would help me figure out the differences to better determine what conditions should be met to log that error.

LeaveMyYard commented 2 weeks ago

I also have found this issue.

While at first it looked like everything is working as expected, I noticed that animation at moments I get this error is not perfect (like it skips a transition for character legs and it appears overall jittery). While on host everything looks smooth, on clients it is not.

So, @NoelStephensUnity, I assume just removing an error is not the solution?

I can also try to make a small example with this error being reproduced, if that will help. But that will take some time