0
0
Unityframework~20 mins

Animator controller in Unity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Animator Controller Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Animator Controller Parameter Change Effect

Consider a Unity Animator Controller with a boolean parameter named isRunning. The Animator has two states: Idle and Run. The transition from Idle to Run happens when isRunning is true, and from Run to Idle when false.

What will be the output of the following code snippet controlling the Animator?

Unity
Animator animator = GetComponent<Animator>();
animator.SetBool("isRunning", true);
bool currentState = animator.GetBool("isRunning");
Debug.Log(currentState);
AFalse
BCompilation error
CNullReferenceException
DTrue
Attempts:
2 left
💡 Hint

Think about what SetBool and GetBool do in the Animator component.

🧠 Conceptual
intermediate
1:30remaining
Animator Controller Transition Conditions

In Unity Animator Controller, which of the following is NOT a valid condition type you can use to control transitions?

AString parameter equality (e.g., stateName == 'Run')
BBoolean parameter check (e.g., isJumping is true)
CTrigger parameter activation
DFloat parameter comparison (e.g., speed &gt; 0.5)
Attempts:
2 left
💡 Hint

Think about the types of parameters Animator supports for transitions.

🔧 Debug
advanced
1:30remaining
Fixing Animator Parameter Name Error

What error will occur when running this code snippet in Unity if the Animator Controller does not have a parameter named jumping?

Unity
Animator animator = GetComponent<Animator>();
animator.SetBool("jumping", true);
ACompilation error
BArgumentException: Parameter 'jumping' does not exist
CNullReferenceException
DNo error, parameter is created automatically
Attempts:
2 left
💡 Hint

Consider what happens if you try to set a parameter that is not defined in the Animator Controller.

Predict Output
advanced
2:00remaining
Animator Trigger Parameter Behavior

Given an Animator Controller with a trigger parameter named attack, what will be the output of this code snippet?

Unity
Animator animator = GetComponent<Animator>();
animator.SetTrigger("attack");
bool isSet = animator.GetBool("attack");
Debug.Log(isSet);
AArgumentException
BFalse
CTrue
DCompilation error
Attempts:
2 left
💡 Hint

Think about the difference between trigger and bool parameters and how GetBool works.

🚀 Application
expert
1:30remaining
Determining Number of States in Animator Controller

You have an Animator Controller with 3 layers. The Base Layer has 4 states, the UpperBody Layer has 3 states, and the LowerBody Layer has 5 states. How many total states are in the Animator Controller?

A3
B5
C12
D7
Attempts:
2 left
💡 Hint

Count all states across all layers.