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. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

Play Mechanim Clip Immediately

Discussion in 'Animation' started by chilton, Sep 12, 2013.

  1. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    503
    Hi,

    How do I tell Mechanim to play a particular clip immediately?

    As far as I can tell, if it's in the middle of one clip, it has to wait until that clip ends before it will read the state and decide on a new course of action.

    Thank you,
    -Chilton
     

    Attached Files:

  2. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    503
    Right now I'm using a custom int variable that I change, and the animations start based on the value of that number. But this only works once the animation has completed. Is there a better way to do this?

    Thank you,
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,082
    The animator should transition as soon as the conditions are true. If one of those conditions are "Exit time," then it won't transition until that time is reached.
     
  4. AdenFlorian

    AdenFlorian

    Joined:
    Feb 15, 2013
    Posts:
    7
    You can use multiple transitions from a state, I just learned. Create another exit transition from a state and then the transition line will have 3 arrows. on the first transition you can leave the exit time, and on the second one you can make a bool forceExit parameter that you can switch on for a frame and then it will transition out on command. Just make sure to turn it off the next frame. I haven't done this myself yet, but it's worth a try.
     
unityunity