# Add(IVariable, string)

> Adds a variable under a unique, whitespace-normalized name and returns that name.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Localization](/engine/6000.7/script-reference/unity/localization.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule

```csharp
public string Add(IVariable variable, string name = null)
```

### Parameters

**** (\[IVariable]\(/engine/6000.7/script-reference/unity/smartstrings/persistentvariables/ivariable)): The variable to store in the group.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): A preferred name for the variable, or null to use the default.

### Returns

| Type                                                           | Description                                         |
| -------------------------------------------------------------- | --------------------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | The unique name that the variable was stored under. |

### Remarks

The requested name is normalized by replacing whitespace with hyphens, then made unique by appending a numeric suffix when needed (for example, `variable`, then `variable-2`). When no name is given, it defaults to `variable`. The returned name is the one the variable is actually stored under.

Add a variable and keep the name it was stored under.

### Examples

```csharp
using Unity.Localization;
using UnityEngine;

namespace Unity.Localization.Samples
{
    public class LocalVariablesGroupAddExample
    {
        public void Add()
        {
            var group = new LocalVariablesGroup();
            var name = group.Add(new LocalizedString(), "subtitle");
            Debug.Log(name);
        }
    }
}
```
