# 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.*

<figure><img src="/files/e4874B4TNq7Ng1T3QuCO" alt=""><figcaption><p><em>This is how the backend of a list of variable holder looks on a Module.</em> </p></figcaption></figure>

<figure><img src="/files/uIrPyduwsMUcLpeWGPxl" alt=""><figcaption><p>This is how that looks in the text or on other elements.</p></figcaption></figure>

*You can access them by their index in the list and by taking the type of data stored.* \
\&#xNAN;***Example:** moduleContainer.variableHolders\[0].*&#x66;loatValue

```
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;
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ferdowsur.gitbook.io/modules/scripting/creating-new-modules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
