Skip to content

[Bug] Transition AnyState -> Stun in State "AnyState" transitions to state Stun which does not exist in controller #66

@nickspath

Description

@nickspath

I've encountered this error and been struggling with it for a couple of days, and after doing every test i've came to the conclusion that it might not be my fault
I have a simple state machine with multiple states and one of which requiring an "AnyTransition", when i do so everything works correctly, it even shows correctly in the Animator Visualizator, but i get this error:

Image

this is the interested code and proof that a state called "Stun" exists

void Start() {
StateMachine fsm = new StateMachine();
fsm.AddState("Stun",
            onEnter: (state) =>
            {
                navMeshAgent.isStopped = true;
                navMeshAgent.SetDestination(transform.position);
                owner.transform.Rotate(new Vector3(0, 0, 90));
                stunParticleSystemEffect.Play();
            },
            onLogic: (state) =>
            {
                stunTimer += Time.deltaTime;
                if (stunTimer >= StunTime)
                {
                    isStunned = false;
                    state.fsm.StateCanExit();
                }
            },
            onExit: state =>
            {
                stunTimer = 0f;
                owner.transform.Rotate(new Vector3(0, 0, -90));
                stunParticleSystemEffect.Stop();
            }, needsExitTime: true);
        fsm.SetStartState("Neutral");
fsm.AddTransitionFromAny("Stun", t => isStunned, forceInstantly: true);
fsm.Init();

#if UNITY_EDITOR
        HfsmAnimatorGraph.CreateAnimatorFromStateMachine(
            fsm,
            outputFolderPath: "Assets/Enemy/Dummy/DebugAnimators",
            animatorName: gameObject.name + ".controller"
        );
#endif
}

void Update()
    {
        fsm.OnLogic();

#if UNITY_EDITOR
        HfsmAnimatorGraph.PreviewStateMachineInAnimator(fsm, fsmAnimator);
#endif
    }

same happens if i use a TriggerTransitionFromAny, deleting the Animator and letting it create one still makes that error too

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions