Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using UnityEngine.UI;
  2. using UnityEngine;
  3. [RequireComponent(typeof(Text))]
  4. public class LocalHelper : MonoBehaviour
  5. {
  6.     private Text _textComponent;
  7.     // Use this for initialization
  8.     void OnEnable()
  9.     {
  10.         LanguageManager.OnLanguageChanged += ChangeLang;
  11.     }
  12.     void OnDisable()
  13.     {
  14.         LanguageManager.OnLanguageChanged -= ChangeLang;
  15.     }
  16.     void Start()
  17.     {
  18.         _textComponent = GetComponent<Text>();
  19.         _textComponent.text = Localization.getLocalizedString(gameObject.name);
  20.     }
  21.  
  22.     void ChangeLang()
  23.     {
  24.         _textComponent.text = Localization.getLocalizedString(gameObject.name);
  25.     }
  26.    
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement