Add(IVariable, string)
Adds a variable under a unique, whitespace-normalized name and returns that name.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
public string Add(IVariable variable, string name = null)
Parameters
Returns
Type | Description |
|---|---|
| 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, , then ). When no name is given, it defaults to . The returned name is the one the variable is actually stored under.
variablevariable-2variableAdd a variable and keep the name it was stored under.
Examples
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); } }}