Using Apex Utility AI to Create a Steering Group with Apex Steer


This document is a part of a series of tutorial documents for getting started with the Apex Utility AI using Apex Path and Apex Steer.

The purpose of this document is to provide a description to the classes used in the scene “AI_Demo_9”, as well as a tutorial on how to create an Apex Steer group from an Apex Utility AI.


Previously we have given each Unit its own AI, but now we want an AI that is able to control more than one Unit. We start by creating an empty GameObject named Group Controller. The GameObject contains a reference to each Unit in the group. The Units do not need an individual AI this time, instead they only need a couple of Components that can easily be added by using the Apex Steer Quick Start called Vector Field Navigation.


Since we have a Group Controller, it should know about the members of the group, we can use the TransientGroup property, where Apex Steer by default stores all the members of the group. This allows us to see and use the group as one entity, and give us the ability to use methods such as MoveTo, which will make all the members of the group move towards a given position, as a group. We could easily create the group immediately, e.g. in the constructor of the Context, however that would not show the use-case of creating a group at runtime through the Apex Utility AI.

Make the group

We want the AI to create the group only if it has not already created one, so in our HasNoGroup class, which is our Contextual Scorer, our code looks like this:

Now, when it comes to actually creating the group, it is also very simple. As we can see in the code below, we can use the GroupingManager to create the group, we just need to pass the unit facades of the members we want to add.


This example will have no visual feedback, so in order to be able to see what is happening, we add a visualizer that draws a Gizmo Cube on every member of the group. To be able to see when it actually creates the group, we set a start delay on the Apex Utility AI to e.g. 5 seconds. This means that if we select the Group Controller, after 5 seconds the AI will execute and we can see the cyan colored cubes on top of the group members’ normal GameObjects. This can be seen in the below screenshot.