Feature request: Triggers that reset after one frame

In Unity's animator controller triggers that are set remain set until they are used by a condition. If the current animator state does not immediately handle that trigger, the trigger is handled in whatever later state does handle that trigger, even were it minutes later.

I request Unity adds a new type of trigger called an immediate trigger, that set until used by a condition OR one Animator update passes, essentially aborting the trigger if not immediately usable.

Examples where one might reasonably use some kind of trigger to start an animation

  • Took damage
  • Died
  • Salute the player when the player walks nearby
  • Attempt to play an attack

In all 4 of these cases, it's easy to think of real-world scenarios where would be better to abort the trigger than use it at some time potentially minutes later. For example, if a character is in a dying state, and is given the salute trigger by unrelated movement code, the salute should be aborted, not played after the character is respawned.

In developing Empire of Ember over 4 years, there is literally not one time I wanted a trigger that uses the current implementation. There however are many times where I wanted an immediate trigger, and had to instead use a boolean that I set for one frame through code or use a trigger that I reset myself. It makes the code even more complicated than it already is.

I hope this feature request is looked at by the developers and doesn't just get ignored. Thanks!

animator.CrossFade does almost exactly what you're asking for, except that you don't set up a parameter or transition at all, you just tell it which state you want in the code (meaning you also specify the fade duration in code rather than being able to tweak it in the Animator Controller).

I agree that the implementation of triggers seems silly. I don't use Animator Controllers anymore since I made Animancer, but back when I did use them I don't think I ever used a single trigger. The only good example I've been able to come up with for them would be an attack combo system where you have multiple attack states with transitions between them all based on a single trigger so that you can do: button press -> set trigger -> when current attack ends the next attack starts. In theory, that could be a useful abstraction for your code to not even care about how many attacks there are in the combo. But in practice, your code is going to need to know whether the character is currently attacking or not for one reason or another, so you're going to need to check if the current state is Attack1, Attack2, etc. and now you've hard coded the number of attacks in your script anyway, turning the "useful abstraction" into a pointless increase in the overall complexity of your game logic.

Yes please we need this feature, triggers not resetting by themselves are hell in our fighting game.