# 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 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.

foreach (AnimatorControllerParameter parameter in playerAnimator.parameters) {

• You can find the info about the AnimatorControllerParameter class in the Unity docs: docs.unity3d.com/ScriptReference/… - please don't forget to accept the answer if it solved your problem. :) – Galandil Jun 17 '17 at 16:29