コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】Unity 5.0 新機能「UnityEngine.iOS.Device」

Unity 5.0 から「UnityEngine.iOS.Device」が追加されました
このクラスを使用することでアプリが動作しているiOS端末の
世代やバージョンなどの情報を取得できます

using UnityEngine;
using UnityEngine.iOS;

public class ExampleClass : MonoBehaviour
{
    private void Awake()
    {
        Debug.Log( "" + Device.advertisingIdentifier         );
        Debug.Log( "" + Device.advertisingTrackingEnabled    );
        Debug.Log( "" + Device.generation                    );
        Debug.Log( "" + Device.systemVersion                 );
        Debug.Log( "" + Device.vendorIdentifier              );
    }
}
プロパティ 説明
advertisingIdentifier 広告 ID
advertisingTrackingEnabled 広告の追跡が可能かどうか
generation デバイスの世代
systemVersion OS のバージョン
vendorIdentifier ベンダー ID

iPhone 6 Plus で試してみる

プロパティ
advertisingIdentifier XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
advertisingTrackingEnabled True
generation iPhone6Plus
systemVersion 8.1.3
vendorIdentifier XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

参考サイト様