Netcode for Gameobjects Network Animator Transition
Asked Answered
V

1

0

I have a simple animator (and the NetworkAnimator script), player idle animation base, with a single animation clip transitioning back and forth based on a bool, in local play it works great, with Netcode for GOs, its a bit weird.

Animation works great on owner (client side), but other clients get an error

[Netcode] [DestinationState To Transition Info] Layer (0) does not exist!

This happens with ANY transition, whether its bool, or trigger, or float, but it does NOT happen with blend trees set as default state that are using a float

image

Vinni answered 24/8, 2023 at 19:3 Comment(1)

In conjunction with b4guw1x's response, there are a few things to watch out for: If you derive from NetworkAnimator, the Awake method is used by NetworkAnimator (i.e. don't hide it by creating a new Awake method in your child class). If you add states or change the Animator itself during runtime, then NetworkAnimator will not work properly as it has to build tables specific to the Animator (and associated layers and states) assigned to it within the editor. The error you are getting would seem that the later of the two "gotchas" could be the culprit.

Substratosphere
S
0

Can you create an OwnerNetworkAnimator script and replace with NetworkAnimator?

using Unity.Netcode.Components

public class OwnerNetworkAnimator : NetworkAnimator
{
    protected override bool OnIsServerAuthoritative()
    { 
        return false;
    }
}
Struggle answered 28/7, 2023 at 10:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.