Is there any good tutorials for creating basic AI in Unity. I’m currently working on a basic 2D stealth game and want to be able to have the AI detect the player with sight using an FOV, and hear the player within a small radius of the AI. Additionally I want to be able to script some basic movements for the AI.
Yes definitely look into the model of creating one class to handle inputs “player controller” and then one class to receive the inputs, “player”. You can use the same model for driving AI.
Usually the objects being controlled implement an interface for receiving commands from the controller. That way the controller can send commands to any object that implements that interface. Imagine playing as a player, then the player gets into a car. You go from sending commands to the player, to sending commands to the car, and they both respond in different ways to the same command.
In the same way, you can drive your AI with an AI controller. The AI controller will be evaluating the situation and sending commands to control a non-player character. By “evaluating” i mean using those functions listed above “distance, raycast, etc” to probe the world and find out what the situation is, like if the AI can see the player.