Unity3D的SystemInfo類,獲取執行裝置硬體資訊(CPU、顯示卡、型別等)可用於手機
一、概述:
UnityEngine.SystemInfo類中的屬性都是隻讀屬性,儲存著執行平臺的一些硬體資訊,找出底層平臺和硬體的功能,如:裝置的名稱、裝置的型別、顯示卡的型別,顯示卡的名稱、顯示卡供應商(製造商)、系統記憶體大小、視訊記憶體大小、支援的渲染目標數量等等。我們也可以檢查支援哪些RenderTexture(渲染紋理)格式(SupportsRenderTextureFormat),CPU有多少可用的執行緒的(processorCount)等等。
二、SystemInfo類中的靜態變數:
中文顯示:
Rendering.CopyTextureSupport copyTextureSupport:(只讀)支援多種複製紋理功能的情況。
string deviceModel:(只讀)裝置的模型或模式。 string deviceName:(只讀)使用者定義的裝置名稱。
DeviceType deviceType:(只讀)返回程式執行所在的裝置型別(PC電腦、掌上型等)。
string deviceUniqueIdentifier:(只讀)裝置的唯一識別符號。每一臺裝置都有唯一的識別符號。
int graphicsDeviceID:(只讀)顯示卡的唯一識別符號ID。 string graphicsDeviceName:(只讀)顯示卡的名稱。 Rending.GraphicsDeviceType graphicsDeviceType:(只讀)顯示卡的型別。
string graphicsDeviceVendor:(只讀)顯示卡的供應商。
int graphicsDeviceVendorID:(只讀)顯示卡供應商的唯一識別碼ID。
string graphicsDeviceVersion:(只讀)顯示卡的型別和版本。
int graphicsMemorySize:(只讀)視訊記憶體大小。
bool graphicsMultiThreaded:(只讀)是否支援多執行緒渲染。 int graphicsShaderLevel:(只讀)顯示卡著色器的級別。
int maxTextureSize:(只讀)支援的最大紋理大小。
NPOTSupport npotSupport:(只讀)GPU支援的NPOT紋理。 string operatingSystem:(只讀)作業系統的版本名稱。
int processorCount:(只讀)當前處理器的數量。 int processorFrequency:(只讀)處理器的頻率。
string processorType:(只讀)處理器的名稱。 int supportedRenderTargetCount:(只讀)支援渲染多少目標紋理。
bool supports2DArrayTextures:(只讀)是否支援2D陣列紋理。 bool supports3DTextures:(只讀)是否支援3D(體積)紋理。
bool supportsAccelerometer:(只讀)是否支援獲取加速度計。 bool supportsAudio:(只讀)是否支援獲取用於回放的音訊裝置。
bool supportsComputeShaders:(只讀)是否支援計算著色器。 bool supportsGyroscope:是否支援獲取陀螺儀。
bool supportsImageEffects:(只讀)是否支援圖形特效。 bool supportsInstancing:(只讀)是否支援例項化GPU的Draw Call。
bool supportsLocationService:是否支援定位功能。 bool supportsMotionVectors:是否支援運動向量。
bool supportsRawShadowDepthSampling:(只讀)是否支援陰影深度。
bool supportsRenderTextures:(只讀)是否支援渲染紋理。 bool supportsRenderToCubemap:(只讀)是否支援立方體紋理。
bool supportsShadows:(只讀)是否支援內建陰影。 bool supportsSparseTextures:(只讀)是否支援稀疏紋理。
bool supportsStencil:(只讀)是否支援模版快取。 bool supportsVibration:是否支援使用者觸控震動反饋。
int systemMemorySize:(只讀)系統記憶體大小。 string unsupportedIdentifier:不支援執行在當前裝置的SystemInfo屬性值。
三、SystemInfo類中的函式
bool SupportsRenderTextureFormat(RenderTextureFormat format); 輸入一個渲染紋理的格式,判斷裝置是否支援這種格式
bool SupportsTextureFormat(TextureFormat format); 輸入一個紋理的格式,判斷裝置是否支援這種格式。
注意:本內容來自https://yq.aliyun.com/ziliao/384644?spm=a2c4e.11155472.blogcont.23.61367f01p3mSTZ