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

Capture state exit point in mecanim?

Discussion in 'Animation' started by sotha_sil, Jan 13, 2014.

  1. sotha_sil

    sotha_sil

    Joined:
    Nov 14, 2013
    Posts:
    7
    Hello, How can I approach generating event between state transition? (In Mecanim) For example I have use state, where player will play one of the unique use animations and then exit back to idle state. How can I capture that transition to use in script?

    For example player clicks button and after animation is finished Door opens. is there something like onStateExit?
     
  2. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    14,776
    You can get the hash ID of the current state. While it's not what I'd call an elegant solution, you could check and store the current state hash each time and fire your own event whenever it changes.
     
  3. sotha_sil

    sotha_sil

    Joined:
    Nov 14, 2013
    Posts:
    7
    Thanks, I guess I'll have to go with something like that.

    I think this feature will be added in next releases or it should be added at least.
     
unityunity