Fighter.Cancel

Line 43 I used fighter.Cancel() which seems to work just as well as getcomponent

Whatever line 43 might be in your project (given the lesson’s context, it should be in AIController?), and supposedly you meant calling GetComponent<ActionScheduler>.CancelCurrentAction()?

But while this might work to cancel the attack behaviour, as Sam has hinted at already there might be any other action going on, so you really would want to grab the ActionScheduler component of the enemy the script is running on, and call its CancelCurrentAction() because the ActionScheduler will actually know which action is active right now.

(FWIW in my implementation I am calling SuspicionBehaviour() on line 53, and its implementation starts at line 71 …)

Privacy & Terms