Complete the code to get the Animator component.
Animator animator = GetComponent<[1]>();The Animator component controls animation states in Unity. Use GetComponent<Animator>() to access it.
Complete the code to trigger a transition using a trigger parameter.
animator.[1]("Jump");
Use SetTrigger to activate a trigger parameter and start a transition in the Animator.
Fix the error in the code to check if the Animator is currently in the 'Run' state.
bool isRunning = animator.GetCurrentAnimatorStateInfo(0).[1]("Run");
IsName is a method that checks if the current state matches the given name. Comparing name or other properties to a string directly won't work.
Fill both blanks to smoothly transition to the 'Attack' animation state.
animator.[1]("Attack", 0, [2]);
Play starts the animation state immediately. The third parameter is the normalized time, where 0f means start from the beginning.
Fill all three blanks to create a dictionary mapping animation states to their durations, filtering only states longer than 1 second.
var durations = new Dictionary<string, float> { {"Idle", 1.2f}, {"Walk", 0.8f}, {"Run", 1.5f} };
var filtered = durations.Where(kv => kv.Value [1] [2]).ToDictionary(kv => kv.Key, kv => kv.Value [3] 0);The code filters states with duration greater than 1 second, then subtracts 0 from the value (no change). The operator > and value 1 filter correctly. The subtraction - 0 keeps the value unchanged.