7
\$\begingroup\$

enter image description here I'm wondering about these two things. for what is better to use Bool rather than Trigger ? If i'm going to use Trigger, I should use it for what ?

\$\endgroup\$
10
\$\begingroup\$

The Bool type is appropriate for representing a state that holds true over a period of time e.g. carrying an item or entering sneak mode .

The Trigger type is appropriate for representing an action that will occur for a short period e.g. recoil from a gun firing or stumbling after a collision. Usually after this action is complete the animation returns back to a normal or default state.

From a mechanical perspective a value passed to Animator.SetBool() will persist within the animation system until changed by a subsequent call to this method. Conversely if a true value is passed to Animator.SetTrigger() the value within the animation system will be automatically reset to false after it has been used in a state transition.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.