-
Notifications
You must be signed in to change notification settings - Fork 459
Description
Description
NetworkAnimator.ParseStateMachineStates() logs Debug.LogError for conditional transitions that target the Exit node of a sub-state machine. These transitions are valid Mecanim configurations — the actual destination is resolved by the parent state machine's StateMachineTransitions — but NetworkAnimator only checks transition.destinationState and transition.destinationStateMachine, both of which are null for Exit transitions.
The error message is:
[<GameObject>][Conditional Transition for <StateName>] Conditional triggered transition has neither a DestinationState nor a DestinationStateMachine! This transition is not likely to synchronize properly.
This is a false positive. The transitions work correctly in Mecanim; the issue is that ParseStateMachineStates does not account for transition.isExit == true when conditions are present.
Additionally, because these transitions are skipped (not added to TransitionStateInfoList), they are also missing from the m_DestinationStateToTransitioninfo lookup table used at runtime for synchronizing late-joining clients. This could mean trigger-based transitions routed through a sub-state machine Exit node may not synchronize properly in multiplayer.
Reproduce Steps
- Create an Animator Controller with a sub-state machine (e.g. "Sub SM")
- Inside the sub-state machine, add a state (e.g. "State A")
- Create a Trigger parameter (e.g.
MyTrigger) - Add a conditional transition from "State A" to the Exit node using
MyTriggeras condition - In the parent state machine, configure
StateMachineTransitionson the sub-state machine node to route to a parent state (e.g.MyTrigger→ "State B") - Add a
NetworkAnimatorcomponent referencing this Animator Controller - Observe
Debug.LogErrorin the Console on everyOnValidate(domain reload, component selection, scene save, etc.)
Actual Outcome
Debug.LogError is logged for each trigger condition on each conditional Exit transition:
[<GameObject>][Conditional Transition for State A] Conditional triggered transition has neither a DestinationState nor a DestinationStateMachine! This transition is not likely to synchronize properly. Please file a GitHub issue about this error with details about your Animator's setup.
These transitions are also not added to TransitionStateInfoList, so they are missing from the runtime synchronization lookup table.
Expected Outcome
ParseStateMachineStatesshould checktransition.isExitbefore logging an error. Exit transitions with conditions are valid — the destination is resolved by the parent state machine'sStateMachineTransitions.- Ideally, the transition info should still be tracked (with the resolved destination from the parent's
StateMachineTransitions) so that trigger-based synchronization works correctly through sub-state machine Exit nodes. - At minimum, no false
LogErrorshould be emitted for valid Animator configurations.
Screenshots
N/A — the issue is in code logic, not visual.
Environment
- OS: Windows 11 Pro (10.0.26200)
- Unity Version: 6000.2.6f2
- Netcode Version: 2.7.0
- Netcode Commit: N/A
- Netcode Topology: Client-Server
Additional Context
The relevant code is in NetworkAnimator.cs, inside the #if UNITY_EDITOR block:
// Line ~250: Exit transitions WITHOUT conditions are correctly skipped
if (transition.conditions.Length == 0 && transition.isExit)
{
// We don't need to worry about exit transitions with no conditions
continue;
}
// Line ~270-296: But exit transitions WITH conditions fall through to the error
switch (parameter.type)
{
case AnimatorControllerParameterType.Trigger:
{
if (transition.destinationStateMachine != null)
{
// Recurses into destination sub-state machine
ParseStateMachineStates(...);
}
else if (transition.destinationState != null)
{
// Adds transition info to TransitionStateInfoList
}
else
{
// This fires for valid Exit transitions with trigger conditions
Debug.LogError($"[{name}][Conditional Transition for {animatorState.name}] ...");
}
break;
}
}Suggested fix: Add an isExit check before the error branch, analogous to how destinationStateMachine is handled — resolving the actual destination via the parent state machine's StateMachineTransitions:
else if (transition.isExit)
{
// Transition targets Exit node — resolve actual destination
// from parent StateMachine's StateMachineTransitions table
// and add resolved transition info to TransitionStateInfoList.
}
else
{
Debug.LogError(...);
}The unconditional Exit transitions (with HasExitTime and no conditions) are already handled correctly at line ~250 with a continue. The gap is specifically for Exit transitions that have trigger conditions (used for interrupting sub-state machine flows like attack combos).