Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

statebehaviour

Discussion in 'Scripting' started by 2dgamemania, Apr 2, 2015.

  1. 2dgamemania

    2dgamemania

    Joined:
    Apr 30, 2014
    Posts:
    153
    Hi,

    I'm using mecanim and when an animation has finished, in this case the character jumps and I want to return the state to the idle state. I am using the behaviour script and within this I have the following code

    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {

    animator.SetBool("Jump", false)

    }

    so within mecanim i expected it to return to the idle state but it just stays on the jump on , any ideas. I am new to using this way of doing things but cant work it out.

    Thanks for any help

    Dave
     
  2. Gamba

    Gamba

    Joined:
    Feb 8, 2015
    Posts:
    29
    Do you have a transition set up in mecanim from the jump state back to idle? And does it transition on the condition of Jump being false?