Show / Hide Table of Contents

    Custom Modules

    IModule

    To create a custom module, simply create a class implementing the IModule interface under the QFSW.BA.Modules namespace; this will turn your class into a Build Automator module that will automatically be loaded and injected into Build Automator for you.

    Modules must have a parameterless constructor (default is permitted) or they will be ignored.

    Tip

    Modules must have unique IDs or they will be rejected. A good way to ensure you stay unique is to use a naming convention such as company.product.feature

    Example

    public class DemoModuleCustom : IModule
    {
        public int DrawOrder => -100000;
        public string ID => "qfsw.docs.demo-custom";
        public int EventCallbackOrder => 0;
        
        public void DrawModule()
        {
            EditorGUILayout.LabelField("I am a module!");
        }
    }
    

    demo-module-custom

    Tip

    If you wish to stop Build Automator from injecting your module for any reason, simply use the [NoInject] attribute on your class.

    Module

    In the vast majority of cases you will want your module to have the same look and feel as the built in modules.

    Inheriting from Module will provide this base functionality as well as providing defaults for non essential options such as draw order.

    Example

    public class DemoModuleCustom : Module
    {
        public override string ID => "qfsw.docs.demo-visible";
        public override string DisplayName => "Demo Module";
    
        protected override void DrawModuleContents()
        {
            EditorGUILayout.LabelField("I am a module!");
        }
    }
    

    demo-module-custom

    Hidden Module

    In some cases you may want to create a module with no GUI, in this case the HiddenModule is a more appropriate base class.

    Example

    public class DemoModuleCustom : HiddenModule
    {
        public override string ID => "qfsw.docs.demo-hidden";
    
        public DemoModuleCustom()
        {
            Debug.Log("Module created!");
        }
    }
    
    Build Automator 2 by QFSW
    Back to top