새소식

유니티

[Unity] Localization Key[ID] 값 비교

  • -
//해당하는 테이블의 언어를 얻어옵니다.
public string GetLocalText(string table, string key)
{
    string txt = "";

    //모바일일 경우 해당 모바일 키가 존재하는지 판단합니다.
    if (!GameConfig.IsPc())
    {
        string tmp_key = key + "_Mobile";
        var collection = LocalizationSettings.StringDatabase.GetTableEntry(table,key);
        string entry = collection.Entry.Key;

        if (entry.Equals(tmp_key))
        {
            txt = LocalizationSettings.StringDatabase.GetLocalizedString(table, tmp_key);
            return txt;
        }
    }

    //현재 key값에 해당하는 텍스트
    txt = LocalizationSettings.StringDatabase.GetLocalizedString(table, key);

    return txt;
}

 

Contents

아핫

땡큐하다