GetSourceValue(ISelectorInfo)
Resolves this string so it can be read as a Smart String placeholder in another string.
Read time 1 minuteLast updated 8 days ago
Definition
- Type: Method
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
public object GetSourceValue(ISelectorInfo selector)
Parameters
Describes the placeholder being resolved.
Returns
Type | Description |
|---|---|
| Object | The resolved text, or an empty string when the reference is unset or the nesting limit is reached. |
Remarks
Add a LocalizedString to another string's LocalizedString.LocalVariables to embed one entry inside another. The nested string reads its own variables layered over the containing string's (a chained scope). Two entries that reference each other resolve as empty and log a warning rather than recursing without end.
Additional Resources: LocalizedString.LocalVariables, LocalVariablesGroup
Embed one localized string inside another as a local variable.
Examples
using Unity.Localization;namespace Unity.Localization.Samples{ public class LocalizedStringNestedExample { public void Nest() { var localizedString = new LocalizedString(); localizedString.SetReference("My Strings", "TITLE"); var nested = new LocalizedString(); nested.SetReference("My Strings", "SUBTITLE"); localizedString.LocalVariables.Add(nested, "subtitle"); } }}