ToggleLanguage.cs 540 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. using System.Collections.Generic;
  3. namespace I2.Loc
  4. {
  5. public class ToggleLanguage : MonoBehaviour
  6. {
  7. void Start ()
  8. {
  9. Invoke("test", 3);
  10. }
  11. void test()
  12. {
  13. //-- to move into the next language ----
  14. List<string> languages = LocalizationManager.GetAllLanguages();
  15. int Index = languages.IndexOf(LocalizationManager.CurrentLanguage);
  16. if (Index<0)
  17. Index = 0;
  18. else
  19. Index = (Index+1) % languages.Count;
  20. //-- Call this function again in 3 seconds
  21. Invoke("test", 3);
  22. }
  23. }
  24. }