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

设备类型.Unknown

建议更改

成功!

感谢你帮助我们提高 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"; } } }