0
0
Unityframework~5 mins

State machines for AI behavior in Unity - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a state machine in AI behavior?
A state machine is a way to organize AI behavior by defining different states and rules to switch between them. It helps AI decide what to do next based on its current situation.
Click to reveal answer
beginner
Name three common states in an AI enemy's state machine.
Common states include: Idle (waiting), Patrol (moving around), and Attack (engaging the player).
Click to reveal answer
intermediate
How does a state machine improve AI behavior in games?
It makes AI predictable and organized, so the AI can react properly to different situations by switching states smoothly.
Click to reveal answer
intermediate
In Unity, what component or script structure is commonly used to implement state machines for AI?
Developers often use C# scripts with enums or classes to represent states and switch logic inside the Update() method or coroutines.
Click to reveal answer
beginner
What triggers a transition between states in a state machine?
Transitions happen when certain conditions or events occur, like spotting the player, losing sight, or reaching a destination.
Click to reveal answer
What does a state machine primarily help an AI do?
ASave game progress
BIncrease the AI's speed
COrganize different behaviors and switch between them
DMake the AI invisible
Which of these is NOT a typical AI state?
AIdle
BPatrol
CAttack
DSleep
In Unity, where is state switching logic usually placed?
AIn the Start() method only
BInside the Update() method
CIn the OnDestroy() method
DIn the Awake() method only
What triggers a state transition in an AI state machine?
AA condition or event like spotting the player
BRandom chance only
CUser input only
DTime of day only
Why is using a state machine better than writing all AI behavior in one big script?
AIt keeps behavior organized and easier to manage
BIt makes the AI run faster
CIt uses less memory
DIt removes bugs automatically
Explain how a state machine controls AI behavior in a game.
Think about how AI decides what to do next.
You got /4 concepts.
    Describe how you would implement a simple AI state machine in Unity using C#.
    Focus on how the code checks and changes states.
    You got /4 concepts.