3 – Groups & Commenting

In this article, we’re going to review two organizational features that are useful in handling large numbers of behaviors.

First, we have the “Group” behavior. Group essentially acts like a big box for other behaviors, and is an excellent way to sort and categorize your behaviors for complex actors. For instance, you might wish to place all of your movement behaviors inside a Group behavior, so those can be minimized and other behaviors more readily changed or added. When you have an actor with a large number of behaviors and rules, it can be useful to categorize them using Groups (ie, “Movement”, or “Scoring”), and then minimize the groups in order to see other behaviors without excessive scrolling.  To use the group behavior, simply drag it into your list of rules and behaviors for an actor, and then drag those rules and behavior into the group box – just like you drag behaviors into timers and rules.  You can rename a group by double-clicking the word “Group”. All the behaviors and rules will be turned off if you toggle the on/off option, which is the second part of this tutorial, known as the “Commenting” ability.

The Commenting ability is present on every behavior, rule, and group, and enables us to turn behaviors on and off. While this is useful for testing behaviors to discover which ones work best, or which ones might be causing a bug, it’s also a very useful behavior for multiple control schemes within one game. For instance, a game published to both PC Desktop and Android might need one control scheme using the keyboard, and another using touch controls. We can easily build both, and then just comment off the unneeded set of controls when publishing.  When a group, rule, or behavior is commented off, it is not included in the final game package when you publish, so commenting off an unneeded item also reduces your final file size.