TextMeshPro with localization and assign value to it from script
3 years 8 months ago #4230
by Tanya
I am using TextMeshPro with localization and assign value to it from script. How can it be configured that it will be changed on the fly?
Consider this code:
[SerializeField]
protected TextMeshProUGUI _goalTitle;
protected override IEnumerator InitializeView(Action<float> onProgress)
{
_goalTitle.text = _entity.GetLocalisedDescription(); //$"{_entity.goalData.Id}";
...
}
LocalizedString descriptionFormat = "Goals/BUY_GENERATOR"; //the terms looks like "aaa {0}"
public override string GetLocalisedDescription()
{
return string.Format(descriptionFormat, _goalData.generatorId);
}
Consider this code:
[SerializeField]
protected TextMeshProUGUI _goalTitle;
protected override IEnumerator InitializeView(Action<float> onProgress)
{
_goalTitle.text = _entity.GetLocalisedDescription(); //$"{_entity.goalData.Id}";
...
}
LocalizedString descriptionFormat = "Goals/BUY_GENERATOR"; //the terms looks like "aaa {0}"
public override string GetLocalisedDescription()
{
return string.Format(descriptionFormat, _goalData.generatorId);
}
Please Log in or Create an account to join the conversation.
Time to create page: 0.147 seconds