Legacy Documentation: Version 2017.2 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

SystemInfo.operatingSystem

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static var operatingSystem: string;
public static string operatingSystem;

Description

Operating system name with version (Read Only).

Returns detailed information about the operating system of the device, including the version. For a simple platform detection, properties like Application.platform or deviceType might be more appropriate.

Note: On Windows Store Apps, it's impossible to tell if the user is running the 32-bit or 64-bit version of Windows. In this situation, the CPU architecture is queried instead. If the CPU is 64-bit, SystemInfo.operatingSystem will return 'Windows <version> 64 bit', and if the CPU is 32-bit - 'Windows <version>'.

#pragma strict
function Start() {
	// Prints "Android OS API-22" on Android 5.1
	Debug.Log(SystemInfo.operatingSystem);
}
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); } }
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答