Search Unity

Question Animation state does not exit

Discussion in 'Animation' started by wuzytech, Sep 20, 2023.

  1. wuzytech


    Mar 13, 2023
    I have 2 animation states named stateA and stateB, I set a transition from stateA to stateB and the condition is "animationID" == 1. I set the Has Exit Time to true and the Exit Time to 1.

    I also noticed the stateB (from a fbx file) had 'Loop Time' enabled on the clip, so I disabled it.

    In the play mode, after I set "animationID" to 1, it will go to stateB. However it will stay/loop forever and won't exit back to stateA
    Muse only asked me to check the 'Loop Time', and set 'has exit time' as well as Exit time set to 1.
    Do you have any other opinions how to make the StateB go back to stateA (and stay at stateA) once finished?

    StateA-----------only one Transition------------>StateB (Loop Time set to false)
    Has Exit Time == true
    Exit Time == 1

    If I add another transition from stateB to stateA with no condition configured, it will endlessly loop between stateA and stateB. I think it's because animationID == 1 still
    StateA(Loop Time set to True)-----------Transition 1------------>StateB (Loop Time set to false)
    Has Exit Time == true
    Exit Time == 1
    Condition: animationID==1

    StateA(Loop Time set to True)<-----------Transition 2------------StateB (Loop Time set to false)
    Has Exit Time == false
    Condition: null

    One way I can think about is to use script to manually set the animationID after a specified time duration(can get length from the animation clip), but it's a little add-hocky
    Last edited: Sep 20, 2023