InputFieldLocalization.cs 631 B

12345678910111213141516171819
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. [RequireComponent(typeof(InputField))]
  5. public class InputFieldLocalization : MonoBehaviour
  6. {
  7. public string key;
  8. void Start() {
  9. // Get the string value from localization manager from key
  10. // and set the text component text value to the returned string value
  11. GetComponent < InputField > ().placeholder.GetComponent<Text>().text = LocalizationManager.Instance.GetText(key);
  12. }
  13. internal void UpdateText() {
  14. GetComponent<InputField>().placeholder.GetComponent<Text>().text = LocalizationManager.Instance.GetText(key);
  15. }
  16. }