An action is a Unity Component of an Agent, enabling it to have behavior and effects on the game. You can think of it as a typical MonoBehaviour such as GoToBehaviour.

What's special about an Action is that it does not do any state planning and all of the work is left to Agent Goap Planner. When there is no action in progress, the planner will use the Agent's states and World States to find the best possible set of actions and the Agent will carry them out.

Making an Action

All SGoap classes are from the SGoap namespace. Create a class that Inherits either Action or BasicAction.

public class FooAction : Action{}
public class FooAction : BasicAction{}

Plan Execution Order

An action will only run if the plan includes it. A plan can be GoTo -> Attack.

It is important to know that before the Action is even considered for the planning sequence, the planner will filter out actions that don't have the AlwaysIncludeInPlan or fails the Action.IsUsable() check.

Note, you can click the arrow to see more details

Action Execution Order

Once your agent has receive the Queue of Actions to run. The following is the cycle of an action.