Skip to main content

How can I change all boolean parameters of an animator to falsefalse?

Here is a solution which I found:

foreach (AnimatorControllerParameter parameter in playerAnimator.parameters) { playerAnimator.SetBool(parameter.name, false);  } 

The problem with this solution is that I will get a warning in console if my parameter in Animator is not a boolean I will get a warning in console. I would not like to be getting that. So, I need somehow to being able to take only parameters of type boolean.

How can I change all boolean parameters of an animator to false?

Here is a solution which I found:

foreach (AnimatorControllerParameter parameter in playerAnimator.parameters) {playerAnimator.SetBool(parameter.name, false);} 

The problem with this solution is that if my parameter in Animator is not a boolean I will get a warning in console. I would not like to be getting that. So, I need somehow to being able to take only parameters of type boolean.

How can I change all boolean parameters of an animator to false?

Here is a solution which I found:

foreach (AnimatorControllerParameter parameter in playerAnimator.parameters) { playerAnimator.SetBool(parameter.name, false);  } 

The problem with this solution is that I will get a warning in console if my parameter in Animator is not a boolean. I would not like to be getting that. So, I need somehow to being able to take only parameters of type boolean.

Source Link
Yaroslav
  • 771
  • 1
  • 10
  • 18

Change all boolean parameters of an Animator in Unity

How can I change all boolean parameters of an animator to false?

Here is a solution which I found:

foreach (AnimatorControllerParameter parameter in playerAnimator.parameters) {playerAnimator.SetBool(parameter.name, false);} 

The problem with this solution is that if my parameter in Animator is not a boolean I will get a warning in console. I would not like to be getting that. So, I need somehow to being able to take only parameters of type boolean.