Version: 2023.2

Device.systemVersion

切换到手册
public static string systemVersion ;

描述

iOS 版本。

字符串形式的 iOS 版本。例如“7.0”或“8.1”。

                        
using UnityEngine;
using UnityEngine.iOS;

public class SystemVersionExample : MonoBehaviour { bool allowFeature = true;

void Start() { // Get the iOS version of the device this is running on string systemVersion = Device.systemVersion;

// Separate the version string to major and minor version numbers string[] separatedVersion = systemVersion.Split('.');

// Parse the major version number to an integer that can be used for comparison int majorVersion = int.Parse(separatedVersion[0]);

// Check if major version number of the device this is running on is below iOS 12 if (majorVersion < 12) { // Log a message and disable the version-specific features. Debug.Log("Sorry, this amazing feature requires iOS 12 and above to work. Please update your iOS version."); allowFeature = false; } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961