Property this
this[string]
Gets or sets the IVariable with the specified name.
Declaration
public IVariable this[string name] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the variable. |
Property Value
| Type | Description |
|---|---|
| IVariable | The found variable. |
Examples
This example shows how to get and add a local variable.
var localizedString = new LocalizedString("My Table", "My Entry");
// An example of a Smart String using the variable would be: "You have {player-money:C}.".
// :C will apply the current Locale currency and number formatting.
localizedString.Add("player-money", new FloatVariable { Value = 100.45f });
// Get a variable from the localized string
var variable = localizedString["player-money"] as FloatVariable;
Debug.Log("The value is " + variable);
Exceptions
| Type | Condition |
|---|---|
| KeyNotFoundException | Thrown if a variable with the specified name does not exist. |