2014年3月20日木曜日

言語設定値の取得

Unityにて端末に設定されている、言語値の取得サンプル(C#)。


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * @file GetLang.cs
 * @attention
 * @note  言語設定取得サンプル
 */
using UnityEngine;
public class GetLang : MonoBehaviour {
 GUIStyle labelStyle;
 
 void Start () {
  labelStyle = new GUIStyle();
  labelStyle.fontSize = 40;// Font size
  labelStyle.normal.textColor = Color.white;
 }
 
 void OnGUI(){
  float x = Screen.width / 8 ;
  float y = Screen.height / 8;
 
        string text = Application.systemLanguage.ToString(); //設定言語値取得
        /*  取得値については公式サイト参照
        */
 
  GUI.Label(new Rect(x, y, x, y), text, labelStyle);
 }
}

0 件のコメント:

コメントを投稿