Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine.UI;
- using UnityEngine;
- [RequireComponent(typeof(Text))]
- public class LocalHelper : MonoBehaviour
- {
- private Text _textComponent;
- // Use this for initialization
- void OnEnable()
- {
- LanguageManager.OnLanguageChanged += ChangeLang;
- }
- void OnDisable()
- {
- LanguageManager.OnLanguageChanged -= ChangeLang;
- }
- void Start()
- {
- _textComponent = GetComponent<Text>();
- _textComponent.text = Localization.getLocalizedString(gameObject.name);
- }
- void ChangeLang()
- {
- _textComponent.text = Localization.getLocalizedString(gameObject.name);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement