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

DeviceType.Console

提供修改建议

成功!

感谢您帮助我们提高 Unity 文档的质量。尽管我们无法接受所有的提交,但我们确实会仔细阅读我们的用户提出的每一项 修改建议,并在有改进必要时进行更新。

关闭

提交失败

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

关闭

取消

说明

一台固定的游戏主机。

//Attach this script to a GameObject
//This script checks what device type the Application is running on and outputs this to the console

using UnityEngine;

public class DeviceTypeExample : MonoBehaviour { //This is the Text for the Label at the top of the screen string m_DeviceType;

void Update() { //Output the device type to the console window Debug.Log("Device type : " + m_DeviceType);

//Check if the device running this is a console if (SystemInfo.deviceType == DeviceType.Console) { //Change the text of the label m_DeviceType = "Console"; }

//Check if the device running this is a desktop if (SystemInfo.deviceType == DeviceType.Desktop) { m_DeviceType = "Desktop"; }

//Check if the device running this is a handheld if (SystemInfo.deviceType == DeviceType.Handheld) { m_DeviceType = "Handheld"; }

//Check if the device running this is unknown if (SystemInfo.deviceType == DeviceType.Unknown) { m_DeviceType = "Unknown"; } } }