青空の月

PHP, Unity, C#, アプリ開発関連について。

端末情報を取得する

Unityで端末の情報を取得するために「SystemInfo」クラスが用意されている。実行するとどんな値が返ってくるのか試してみた。

MBPとWindowsはUnityEditorで実行した結果。

iOS端末でiPhone5やiPod TouchiPhoneの世代は「iPhone.generation」で取得できる。

 

 

 こんなスクリプトで取得した。

    static Dictionary<string, string> m_dicSysInfo = null;

	public static Dictionary<string, string> GetSysInfo()
	{
		if (m_dicSysInfo != null) return m_dicSysInfo;

		m_dicSysInfo = new Dictionary<string, string>();

		m_dicSysInfo.Add("operatingSystem", SystemInfo.operatingSystem);

#if UNITY_IPHONE
		m_dicSysInfo.Add("iPhone.generation", iPhone.generation.ToString());
#endif

		m_dicSysInfo.Add("deviceUniqueIdentifier", SystemInfo.deviceUniqueIdentifier);
		m_dicSysInfo.Add("deviceModel", SystemInfo.deviceModel);
		m_dicSysInfo.Add("deviceName", SystemInfo.deviceName);
		m_dicSysInfo.Add("graphicsDeviceName", SystemInfo.graphicsDeviceName);
		m_dicSysInfo.Add("graphicsDeviceVendor", SystemInfo.graphicsDeviceVendor);
		m_dicSysInfo.Add("processorType", SystemInfo.processorType);
		m_dicSysInfo.Add("graphicsMemorySize", SystemInfo.graphicsMemorySize.ToString());
		m_dicSysInfo.Add("systemMemorySize", SystemInfo.systemMemorySize.ToString());

		foreach (string key in m_dicSysInfo.Keys)
		{
			Debug.Log(key + "=" + m_dicSysInfo[key]);
		}

		return m_dicSysInfo;
	}


 

 

deviceNameは英数字以外(日本語など)が含まれていることもあるので念のため注意。

メモリサイズはMB単位。

 

  macbook pro
operatingSystem Mac OS X 10.7.5
iPhone.generation Unknown
deviceUniqueIdentifier XXXXXXXX-56A1-5FCD-9635-6093D0000000
deviceModel MacBookPro8,3
deviceName pcname
graphicsDeviceName Emulated iPhone 3GS / iPad running OpenGL ES2.0
graphicsDeviceVendor Emulated
processorType Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
graphicsMemorySize 1024
systemMemorySize 16384

 

  Windows7 64bit
operatingSystem Windows 7 Service Pack 1 (6.1.7601) 64bit
iPhone.generation  
deviceUniqueIdentifier xxxxxxxxxxxedc8babd1038ee7e0a992fe0d90d9
deviceModel Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz (16380 MB)
deviceName PC_NAME
graphicsDeviceName Emulated generic GPU running OpenGL ES2.0
graphicsDeviceVendor Emulated
processorType Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
graphicsMemorySize 2278
systemMemorySize 16380

 

  android SH-02E
operatingSystem Android OS 4.0.4 / API-15 (SC110/01.00.04)
iPhone.generation  
deviceUniqueIdentifier 000000000343428
deviceModel SHARP SH-02E
deviceName <unknown>
graphicsDeviceName Adreno (TM) 320
graphicsDeviceVendor Qualcomm
processorType ARMv7 Processor rev 2 (v7l)
graphicsMemorySize 151
systemMemorySize 1897

 

  iPhone5
operatingSystem iPhone OS 6.1.2
iPhone.generation iPhone5
deviceUniqueIdentifier xxxxxxxxxxx4814fa7cd7ed1e6991dea
deviceModel iPhone
deviceName iPhone5会社
graphicsDeviceName PowerVR SGX 543
graphicsDeviceVendor Imagination Technologies
processorType ARMv7
graphicsMemorySize 256
systemMemorySize 515

 

 

SystemInfo

http://docs-jp.unity3d.com/Documentation/ScriptReference/SystemInfo.html

Unity モバイル スクリプティング上級者向け

http://docs-jp.unity3d.com/Documentation/Manual/MobileAdvanced.html

 iPhone.generation

http://docs-jp.unity3d.com/Documentation/ScriptReference/iPhone-generation.html

 

ちょっとふるいiphonesettingは非推奨

http://d.hatena.ne.jp/nakamura001/20120614/1339688557