Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

LocalizedString.GetSourceValue

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public object GetSourceValue(ISelectorInfo selector);

Parameters

Parameter Description
selector Describes the placeholder being resolved.

Returns

object The resolved text, or an empty string when the reference is unset or the nesting limit is reached.

Description

Resolves this string so it can be read as a Smart String placeholder in another string.

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

<para>Embed one localized string inside another as a local variable.</para>

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