Dowload as PDF

1.1. Controllers

Primary and most important component of the asset is the CallbackerConrtoller. It's located in the components menu: Holy Shovel Soft > Mecanim Callbacker > Callbacker Controller.

Primary functions of this component:

  • Processing of all events, happening in Mecanim Animator.
  • Processing of all event observers, registered in this controller.

The most of often scenario of using this component is the following pipeline:

  1. To register event observer in the controller in one way or another.
  2. Wait for controller initialization.
  3. Create/get necessary entities and register existing callbacks.
  4. When reseting, clear out links to cached entities.

Now, to talk more in detail about settings.

Preset mode

This setting defines which preset will be used for controllers work. (You can read more about presets themselves and their work in the next section)

When selecting option Off, the preset won't be used at all. This presumes that all entities are created in runtime, using code.

Local offers saving the preset "inside" the component without creating assets within the project. Local preset can be used in the scenario when this controller is attached to highly specialized object and nowhere else will such a set of entities be used.

Unlike local preset, Global option lets you use presets as saved within the project and to reuse it on different objects, if needed.

In the case of switching from Local to Global or back, options will be offered to clear out all current settings, as well as options for convertion of the preset.

Pool mode

This option defines which way the major mass of internal objects, required for controllers work, will be instantiated. In common cases, it's nothing you need to worry about and set the option to Off, as the objects are only created during initalization and creation of entities from code, which usually happens at scene start. Usually when exiting the scene, these objects are collected into the Garbage Collector. But if your game logic dictates that objects with this controller are often destroyed and created, then to lessen GC calls the good option would be to turn on one of the following options.

Global – creates all objects within the limits of one pool, common for all controllers, which will exist throughtout the entire game session. This option is useful not only if you often recreate objects with this controller, but also if the average number of concurrent objects is roughly similar during the game session. In this case the number of entities in the pool won't constantly increase and at a particular stage the pool would be able to service all future controllers.

Local – creates local pool for each controller, which will be used only by that controller. This options doesn't help to avoid unnecessary Garbage Collecting during constant recreation of objects with this controller, but will help during it's constatnt turning off / on / calling Reset method. As every reset with consequent turning on calls initialization of all objects anew, this option helps to keep the number of created objects on the "previous level" without their regular reset via GC.

It's important to understand, that when using pools, all entities that were created or got from the controller, when resetting the controller, can be reused. Hence, when resetting the controller it's necessary to clear out all cached entities.

Reset type

(You can read more about resetting and initialization in the section dedicated to Event observers)

This setting defines which way and when controller reset will be called

On Preset Change – reset will be called if during game sessions preset has changed. preset mode is defined in Global state.

On Animator Change – reset will be called if during the game session AnimatorController in Mecanim Animator will change.

On Both Change – as is clear from the name, the controller reset will be called if either preset or AnimatorController changes.

By Script – in this case controller won't be reset automatically. Reset could be initiatied by calling method Reset. This method works only when this option is chosen.

Observers mode

This setting lets you run automatic registration of Components, which implement interface of IEventObserver. In the case of Off search won't be performed. Self will look through all Components of this object. Self and Childs will look through all Components of this object and that object's children.

Debug mode

This option works only in the editor of Development Build (with some restrictions of output of information). After choosing one or several of given options, you can receive information about processes inside the component. By selecting Event Fire, for example, you will see logging of calls of all events, created within this controller.


This massive lets you register components of event observers, that were inherited from MonoCallbackerObserver. This component itself implements all interfaces, available to IEventObserver


List of all callbacks available to this controller in the type of UnityEvent. Equivalent to analogous callbacks available from the code, hence to subscribe to events in most cases you only need to register your methods in this controller. Also these UnityEvents can be very useful during prototyping stage.

Yes No
0 of 0 users found this section helpful
Suggest Edit