59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using System;
|
||
|
using TMPro;
|
||
|
|
||
|
public class TranslateMeshText : MonoBehaviour
|
||
|
{
|
||
|
public string textEnglish;
|
||
|
public string textPolish;
|
||
|
public TMP_Text displayText;
|
||
|
private string language;
|
||
|
// Start is called before the first frame update
|
||
|
void Start()
|
||
|
{
|
||
|
language = PlayerPrefs.GetString("language");
|
||
|
|
||
|
if (PlayerPrefs.HasKey("language"))
|
||
|
{
|
||
|
language = PlayerPrefs.GetString("language");
|
||
|
if (language == "English")
|
||
|
{
|
||
|
displayText.text = textEnglish;
|
||
|
}
|
||
|
else if (language == "Polish")
|
||
|
{
|
||
|
displayText.text = textPolish;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
displayText.text = textEnglish;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
language = PlayerPrefs.GetString("language");
|
||
|
|
||
|
if (PlayerPrefs.HasKey("language"))
|
||
|
{
|
||
|
language = PlayerPrefs.GetString("language");
|
||
|
if (language == "English")
|
||
|
{
|
||
|
displayText.text = textEnglish;
|
||
|
}
|
||
|
else if (language == "Polish")
|
||
|
{
|
||
|
displayText.text = textPolish;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
displayText.text = textEnglish;
|
||
|
}
|
||
|
}
|
||
|
}
|