ドキュメント

Unity Engine

Unity Engine

Add(IVariable, string)

Adds a variable under a unique, whitespace-normalized name and returns that name.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
public string Add(IVariable variable, string name = null)

Parameters

variable

The variable to store in the group.

name

A preferred name for the variable, or null to use the default.

Returns

Type

Description

stringThe 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

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