Creating an AI enemy character or an NPC using state machine improves the performance and keeps the code organized. If you want to learn the basics of state machine then check out out article on the basics of state machine.
https://vionixstudio.com/2023/05/31/u...
#unitytutorialforbeginners #unitytutorials #finitestatemachine #FSM #unitystates #gamedesign