iOS 设备代。
using UnityEngine; using UnityEngine.iOS;
public class DeviceGenerationExample : MonoBehaviour { string m_DeviceGeneration = "Undefined";
void Start() { // Check if the device running this is an "iPhone 14 Pro Max" if (Device.generation == DeviceGeneration.iPhone14ProMax) { m_DeviceGeneration = "iPhone 14 Pro Max"; } // Check if the device running this is an 'iPad Mini (6th generation)" if (Device.generation == DeviceGeneration.iPadMini6Gen) { m_DeviceGeneration = "iPad Mini (6th generation)"; } // Check if the device running this is an "iPod Touch (7th generation)" if (Device.generation == DeviceGeneration.iPodTouch7Gen) { m_DeviceGeneration = "iPod Touch (7th generation)"; }
// Check if the device running this is an unknown iPhone if (Device.generation == DeviceGeneration.iPhoneUnknown) { m_DeviceGeneration = "Unknown iPhone"; } // Check if the device running this is an unknown iPad if (Device.generation == DeviceGeneration.iPadUnknown) { m_DeviceGeneration = "Unknown iPad"; } // Check if the device running this is an unknown iPod Touch if (Device.generation == DeviceGeneration.iPodTouchUnknown) { m_DeviceGeneration = "Unknown iPod Touch"; } // Output the device generation to the console/device log Debug.Log("Device generation: " + m_DeviceGeneration); } }
| iPhone | 第一代 iPhone。 |
| iPhone3G | 第二代 iPhone。 |
| iPhone3GS | 第三代 iPhone。 |
| iPodTouch1Gen | 第一代 iPod Touch。 |
| iPodTouch2Gen | 第二代 iPod Touch。 |
| iPodTouch3Gen | 第三代 iPod Touch。 |
| iPad1Gen | 第一代 iPad。 |
| iPhone4 | 第四代 iPhone。 |
| iPodTouch4Gen | 第四代 iPod Touch。 |
| iPad2Gen | 第二代 iPad。 |
| iPhone4S | 第五代 iPhone。 |
| iPad3Gen | 第三代 iPad。 |
| iPhone5 | iPhone 5。 |
| iPodTouch5Gen | 第五代 iPod Touch。 |
| iPadMini1Gen | 第一代 iPad Mini。 |
| iPad4Gen | 第四代 iPad。 |
| iPhone5C | iPhone 5C。 |
| iPhone5S | iPhone 5S。 |
| iPadAir1 | iPad Air。 |
| iPadMini2Gen | 第二代 iPad Mini。 |
| iPhone6 | iPhone 6。 |
| iPhone6Plus | iPhone 6 Plus。 |
| iPadMini3Gen | 第三代 iPad Mini。 |
| iPadAir2 | iPad Air 2。 |
| iPhone6S | iPhone 6S。 |
| iPhone6SPlus | iPhone 6S Plus。 |
| iPadPro1Gen | 第一代 iPad Pro 12.9"。 |
| iPadMini4Gen | 第四代 iPad Mini。 |
| iPhoneSE1Gen | 第一代 iPhone SE。 |
| iPadPro10Inch1Gen | 第一代 iPad Pro 9.7"。 |
| iPhone7 | iPhone 7。 |
| iPhone7Plus | iPhone 7 Plus。 |
| iPodTouch6Gen | 第六代 iPod Touch。 |
| iPad5Gen | 第五代 iPad。 |
| iPadPro2Gen | 第二代 iPad Pro 12.9"。 |
| iPadPro10Inch2Gen | 第二代 iPad Pro 10.5",10" iPad。 |
| iPhone8 | iPhone 8。 |
| iPhone8Plus | iPhone 8 Plus。 |
| iPhoneX | iPhone X。 |
| iPhoneXS | iPhone XS。 |
| iPhoneXSMax | iPhone XSMax。 |
| iPhoneXR | iPhone XR。 |
| iPadPro11Inch | 第一代 iPad Pro 11"。 |
| iPadPro3Gen | 第三代 iPad Pro 12.9"。 |
| iPad6Gen | 第六代 iPad。 |
| iPadAir3Gen | 第三代 iPad Air。 |
| iPadMini5Gen | 第五代 iPad Mini。 |
| iPhone11 | iPhone 11。 |
| iPhone11Pro | iPhone 11 Pro。 |
| iPhone11ProMax | iPhone 11 Pro Max。 |
| iPodTouch7Gen | 第七代 iPod Touch。 |
| iPad7Gen | 第七代 iPad。 |
| iPhoneSE2Gen | 第二代 iPhone SE。 |
| iPadPro11Inch2Gen | 第二代 iPad Pro 11"。 |
| iPadPro4Gen | 第四代 iPad Pro 12.9"。 |
| iPhone12Mini | iPhone 12 Mini。 |
| iPhone12 | iPhone 12。 |
| iPhone12Pro | iPhone 12 Pro。 |
| iPhone12ProMax | iPhone 12 Pro Max。 |
| iPad8Gen | 第八代 iPad。 |
| iPadAir4Gen | 第四代 iPad Air。 |
| iPad9Gen | 第九代 iPad。 |
| iPadMini6Gen | 第六代 iPad Mini。 |
| iPhone13 | iPhone 13。 |
| iPhone13Mini | iPhone 13 Mini。 |
| iPhone13Pro | iPhone 13 Pro。 |
| iPhone13ProMax | iPhone 13 Pro Max。 |
| iPadPro5Gen | 第五代 iPad Pro 12.9"。 |
| iPadPro11Inch3Gen | 第三代 iPad Pro 11"。 |
| iPhoneSE3Gen | 第三代 iPhone SE。 |
| iPadAir5Gen | 第五代 iPad Air。 |
| iPhone14 | iPhone 14。 |
| iPhone14Plus | iPhone 14 Plus。 |
| iPhone14Pro | iPhone 14 Pro。 |
| iPhone14ProMax | iPhone 14 Pro Max。 |
| iPadPro6Gen | 第六代 iPad Pro 12.9"。 |
| iPadPro11Inch4Gen | 第四代 iPad Pro 11"。 |
| iPad10Gen | 第十代 iPad。 |
| iPhone15 | iPhone 15。 |
| iPhone15Plus | iPhone 15 Plus。 |
| iPhone15Pro | iPhone 15 Pro。 |
| iPhone15ProMax | iPhone 15 Pro Max。 |
| iPhone16 | iPhone 16。 |
| iPhone16Plus | iPhone 16 Plus。 |
| iPhone16Pro | iPhone 16 Pro。 |
| iPhone16ProMax | iPhone 16 Pro Max。 |
| iPhoneUnknown | 未知 iPhone。 |
| iPadUnknown | 未知 iPad。 |
| iPodTouchUnknown | 未知 iPod Touch。 |