Creating new Modules

To create modules, you have to understand how the VariableHolder class work.

The Variable holder contains two main parts. What type of variable? The value of the variable.

Modules contain a list of VariableHolder. For example, one for the duration, one for the animation curve, etc. This kind of structure allows an easier way to modify the module for each use case.

You can access them by their index in the list and by taking the type of data stored. Example: moduleContainer.variableHolders[0].floatValue

using System.Collections;
using UnityEngine;
using TinyGiantStudio.Modules;

[CreateAssetMenu(menuName = "YourModules/Module Name")]
public class YourModule : Module
{
    public override IEnumerator ModuleRoutine(GameObject obj, VariableHolder[] variableHolders)
    {
        //Do your stuff here
    }

    public override string VariableWarnings(VariableHolder[] variableHolders)
    {
        string warning = string.Empty;

        if (variableHolders == null)
                return warning;

        if (variableHolders.Length < 1)
                return warning;
        
        //Add your warning here
        //warning = AddWarning("Please specify a particle prefab to spawn.", warning);
        return warning;
    }
}

Last updated