1.4. Categories and Groups
Lets begin with that Categories and Groups are united in one section due to their similarities, but they are different things and should be used for different goals. Both of them are meant for tracking events, happening with AnimatorController states, uniting in them one, several or even all states.
Primary (and only) difference between Categories and Groups is how events contained in them are processed. Categories processes all its events as if it was one entity. For easier understanding you can consider them analogous to SubStateMachine from AnimatorController. Meanwhile, Groups processes events of states separately for every state. Both Categories and Groups offer following events:
- OnStart – this event triggers when AnimatorController enters state, contained in the entity. In the case with Category it will be called only if on start of state no other state from the list is active.
- OnTick – this event will be called every Update or LateUpdate (depending on the settings of Animator component) if any state from Category is active (in case with Group it will be called for every active state).
- OnEnd – will be called upon exiting the last active at that moment state in Category and for every exit ouf of state in Group.
- OnLoop (only for Groups) – will be called every cycle of active state in the list.
As well as regular events, these entities also offer Transitions events. These events can be tracked on all transitions which leave or arrive to any state from the list. Or you can control direction, as well as states themselves, relation to transition.
- OnStart – called on start of the transition.
- OnTick – called every Update or LateUpdate analogous to usual OnTick.
- OnEnd – will be called on transition end..
Important detail is the fact that in case with Category Transitions events can't be processed if both states (original and goal) are within the given Category, as for the entity itself no transition occurs. When using Groups, this limitation does not exist.
The the least important option is Excluding – entities with this option track events not for all states listed within, but all states not listed.
For exameple, if regular Group lists following states: "walk", "jump" and "idle", and animator also has "attack and die", then in regular Group events will relate to "walk", "jump" and "idle", but in Excluding Group, events will relate to "attack" and "die".
Editors are absolutely analagous for both types, so lets have a look at an example of Categories editor.
This editor lets you add, delete and edit Categories or Groups. For PresetWrapper button for adding new entities also lets you to create clean or full copy of entities from parent preset. Name of every entity is editable; the button for deleting entity is located to the right of the name. These control elements are identical for all entities, hence onwards we will look only at unique control elements.
Primary elements for entity control:
- Excluding – whether this entity is excluding or not.
beginning with which threshhold state is considered active, in the case the weight of the layer of this entity is other than 1
- Layer weight tolerance – beginning with which threshhold state is considered active, in the case the weight of the layer of this entity is other than 1.
- States – list of states included in this entity, you also have ability to preview states.