The ModularBehaviour component is designed to work for inheritance and composition approaches. You can create your own class and inherit the from it or directly use it as a component and use the events and public functions.
You can control the automatic initialization of the modules by modifying
InitOnStart. During the initialization process, the ModularBehaviour will first search for the modules on its GameObject and its children, according to what you specified in the Modules section of the inspector. Then it will initialize them in an order that satisfies the user specified dependencies.
If a module fails its initialization, the ModularBehaviour will log a helpful error and shutdown the already initialized modules in the reverse order of their initialization. If it fails, it tries to do it gracefully.
Composition or Inheritance
This component is made to work with the two approaches but we recommand you to use the Composition approach. You won't gain much by using the inheriting from ModularBehaviour and it locks your inheritance possibilites, since the C# language allows you to inherit from only one class.
Using the composition approach, you can register to the
InitializeCallback which will fire at the end of the initialization with a boolean parameter, specifying if the initialization succeeded or not. And register to the
ShutdownCallback if you are interested to know when the modules get shutdown, but keep in mind that it is not fired if the modules get shutdown during the initialization stage.