Version: 2021.2

SystemInfo.operatingSystem

切换到手册
public static string operatingSystem ;

描述

包含版本的操作系统名称(只读)。

返回有关设备操作系统的详细信息,包括版本。对于简单的平台检测,使用 Application.platformdeviceType 等属性可能更加合适。

注意:在 Windows 应用商店应用程序中,无法判断用户运行的是 32 位还是 64 位版本的 Windows。在这种情况下,需要改为查询 CPU 体系结构。如果 CPU 为 64 位,SystemInfo.operatingSystem 将返回“Windows <version> 64 bit”,如果 CPU 为 32 位,则返回“Windows <version>”。

using UnityEngine;

public class ExampleClass : MonoBehaviour { void Start() { // Prints "Windows 7 (6.1.7601) 64bit" on 64 bit Windows 7 // Prints "Mac OS X 10.10.4" on Mac OS X Yosemite // Prints "iPhone OS 8.4" on iOS 8.4 // Prints "Android OS API-22" on Android 5.1 Debug.Log(SystemInfo.operatingSystem); } }

另请参阅:Application.platformdeviceType

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961