版本:Unity 6 (6000.0)
语言英文
  • C#

设备.systemVersion

建议更改

成功!

感谢您帮助我们提高 Unity 文档的质量。虽然我们无法接受所有提交,但我们确实会阅读每一位用户提出的建议更改,并在适用情况下进行更新。

关闭

提交失败

您的建议更改由于某种原因无法提交。请在几分钟后<a>重试</a>。感谢您花时间帮助我们提高 Unity 文档的质量。

关闭

取消

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; } } }