Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Play Animation state machine at edit time.

Discussion in 'Animation' started by mashc, Nov 15, 2019.

  1. mashc

    mashc

    Joined:
    May 15, 2013
    Posts:
    14
    Hi,

    I have setup a reasonably complex statemachine. The states changes are mainly triggers emitted by code.

    Is there a way to 'play' this state machine in the edit (along with animations) and trigger the transitions somehow? Or should I write a custom edit script that will do this for me?

    Cheers
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    619
    You can't do it out of the box so you will need an editor script (though I've never tried doing it with an Animator Controller so I'm not even sure if it's possible).

    But it's definitely possible if you use the Playables API (Animancer allows animations to be played in Edit Mode). One thing to be aware of is that it doesn't work properly in Unity versions older than 2018.3 and I expect the same limitation would apply to Animator Controllers.
     
  3. mashc

    mashc

    Joined:
    May 15, 2013
    Posts:
    14
    Animancer looks interesting, thanks for the headsup!

    I ended up just creating an empty scene with only my character in it. Then setup key events in a script to trigger the different state machine parameters in game mode. Works OK. It would be nicer if unity supported state machine playback at edit time though.