Complete the code to set an Animator parameter named "speed" to a float value.
Animator animator = GetComponent<Animator>(); animator.SetFloat("speed", [1]);
The SetFloat method requires a float value. Here, 5.0f is a float literal.
Complete the code to check if the Animator parameter "isJumping" is true.
Animator animator = GetComponent<Animator>(); if (animator.GetBool("isJumping") == [1]) { // Jump logic here }
The GetBool method returns a boolean. To check if the parameter is true, compare it to true.
Fix the error in the code to set the Animator trigger parameter "attack".
Animator animator = GetComponent<Animator>(); animator.[1]("attack");
To activate a trigger parameter, use SetTrigger. Other methods are for different parameter types.
Fill both blanks to create a dictionary of animation parameters with their types.
var animationParams = new Dictionary<string, [1]>() { {"speed", [2].Float}, {"isRunning", AnimatorControllerParameterType.Bool} };
The dictionary maps parameter names to their types using AnimatorControllerParameterType.
Fill all three blanks to set multiple Animator parameters correctly.
Animator animator = GetComponent<Animator>(); animator.[1]("jumpHeight", 2.5f); animator.[2]("isGrounded", [3]);
Use SetFloat for float parameters, SetBool for boolean parameters, and true as the boolean value.