- Home /
Question by
LeytonViner · Mar 07, 2018 at 02:54 PM ·
animationif-statementsbooleans
Detect if a variable is a Boolean?
I'm almost finished with my project, and one thing that im trying to fix are the warnings.l I have an animator script which turns off all booleans in the animator, but it keeps saying that floats are not booleans. I just need a way to exclude these floats from the list of variables i need to turn off. Thanks in advance!
Comment
Best Answer
Answer by Lilius · Mar 07, 2018 at 03:09 PM
Here:
private void AllBooleansFalse()
{
foreach (AnimatorControllerParameter parameter in yourAnimatorVariableHere.parameters)
{
if (parameter.type == AnimatorControllerParameterType.Bool)
{
yourAnimatorVariableHere.SetBool(parameter.name, false);
}
}
}
Your answer

Follow this Question
Related Questions
Don't play another animation if a specific animation is already playing? 0 Answers
C# Question Regarding If Statement Errors, Booleans 1 Answer
Animation Question 1 Answer
Playing the right animation when running and not running 0 Answers
Check if player is moving but not by checking velocity. 2 Answers