- Home /
Playing an Animation only once Unity 4
So we've been working on a turn based game for a while in unity 4 and we've been looking for a way to play an attack animation only once. There is a ton of documentation on how to do this in previous versions of unity but we're at a loss for unity 4.
Think like advance wars or final fantasy tactics.
I think in the Animation class, you should be able to get the correct AnimationState variable for the attack animation, and from this you should be able to set its Wrap$$anonymous$$ode to "Once". You might also be able to select your animation in the Project window and change the Wrap$$anonymous$$ode in the inspector.
I should have mentioned we're using mechanim and not legacy animations so I don't believe using wrapmode is viable anymore. We have Loop unchecked and it should be returning to the idle state but the parameter is still set to true so it plays the animation again. We're using a Wait as a work around right now but I was wondering if there is a more elegant solution.