Created
March 18, 2022 10:06
-
-
Save der-hugo/06b02044ed2907fa4f120acd27ccee90 to your computer and use it in GitHub Desktop.
Reset all triggers of an Aniamtor -> attach this to the Basic Layer in order to automatically apply it to all states
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class AnimatorTriggerResetter : StateMachineBehaviour | |
{ | |
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) | |
{ | |
foreach(var p in animator.parameters) | |
{ | |
if (p.type == AnimatorControllerParameterType.Trigger) | |
{ | |
animator.ResetTrigger(p.name); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment