| Parameter | Description |
|---|---|
| variable | The variable to store in the group. |
| name | A preferred name for the variable, or null to use the default. |
string The unique name that the variable was stored under.
Adds a variable under a unique, whitespace-normalized name and returns that name.
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.
<para>Add a variable and keep the name it was stored under.</para>
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); } } }