SystemInfo獲取設備系統參數


using UnityEngine;
using System.Collections;
using System.Collections.Generic;
publicclassGameControllerScript:MonoBehaviour
{
//指定輸出文本框
publicUnityEngine.UI.Text messageText;
//存儲臨時字符串
System.Text.StringBuilder info =newSystem.Text.StringBuilder();
// Use this for initialization
voidStart()
{
//將輸出文本框置空
messageText.text ="";
info.AppendLine("設備與系統信息:");
//設備的模型
GetMessage("設備模型",SystemInfo.deviceModel);
//設備的名稱
GetMessage("設備名稱",SystemInfo.deviceName);
//設備的類型
GetMessage("設備類型(PC電腦,掌上型)",SystemInfo.deviceType.ToString());
//系統內存大小
GetMessage("系統內存大小MB",SystemInfo.systemMemorySize.ToString());
//操作系統
GetMessage("操作系統",SystemInfo.operatingSystem);
//設備的唯一標識符
GetMessage("設備唯一標識符",SystemInfo.deviceUniqueIdentifier);
//顯卡設備標識ID
GetMessage("顯卡ID",SystemInfo.graphicsDeviceID.ToString());
//顯卡名稱
GetMessage("顯卡名稱",SystemInfo.graphicsDeviceName);
//顯卡類型
GetMessage("顯卡類型",SystemInfo.graphicsDeviceType.ToString());
//顯卡供應商
GetMessage("顯卡供應商",SystemInfo.graphicsDeviceVendor);
//顯卡供應唯一ID
GetMessage("顯卡供應唯一ID",SystemInfo.graphicsDeviceVendorID.ToString());
//顯卡版本號
GetMessage("顯卡版本號",SystemInfo.graphicsDeviceVersion);
//顯卡內存大小
GetMessage("顯存大小MB",SystemInfo.graphicsMemorySize.ToString());
//顯卡是否支持多線程渲染
GetMessage("顯卡是否支持多線程渲染",SystemInfo.graphicsMultiThreaded.ToString());
//支持的渲染目標數量
GetMessage("支持的渲染目標數量",SystemInfo.supportedRenderTargetCount.ToString());
//輸出
messageText.text = info.ToString();
}
// Update is called once per frame
voidUpdate()
{
//退出
if(Input.GetKeyUp("escape"))
{
if(Input.GetKeyUp("escape"))
{
Application.Quit();
}
}
}
voidGetMessage(paramsstring[] str)
{
if(str.Length==2)
{
info.AppendLine(str[0]+":"+ str[1]);
}
}
}

 

 






免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM