ContainsName(string)
Determines whether a variable is stored under the given name.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
public bool ContainsName(string name)
Parameters
The variable name to look for.
Returns
Type | Description |
|---|---|
| bool | |
Remarks
Lookup is case-sensitive and matches the whitespace-normalized name assigned by LocalVariablesGroup.Add.
Check whether a variable exists before using it.
Examples
using Unity.Localization;using Unity.SmartStrings.PersistentVariables;using UnityEngine;namespace Unity.Localization.Samples{ public class LocalVariablesGroupContainsNameExample { public void Check() { var group = new LocalVariablesGroup(); group.Add(new IntVariable { Value = 5 }, "score"); if (group.ContainsName("score")) Debug.Log("Score variable is set."); } }}