Search Unity

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:
    15,620
    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.