What's the best method to make this AI?

I’m trying to make an AI that can perform various tasks in the game and react to the player, however I’m unsure of how to make it so the AI’s current task can be cancelled when reacting to a player or interrupted, I have looked through the devforum and a few results from google however none of them have helped me much. So far I have tried using a coroutine to stop/start the task whenever I need to however it didn’t seem to work very well.

I’m unable to post any of the code I have right now because I’m on mobile however I can edit my post to include it later when I’m on PC.

2 Likes

I did more research and ended up discovering Behaviour Trees were the solution to my problem