Unity で PC ハードウェア情報を読み取る---SystemInfo

Unity3D の SystemInfo クラスは、実行中のデバイスのハードウェア情報 (CPU、グラフィックス カード、タイプなど) を取得するために使用されます。
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 runningSystem: (読み取り専用) オペレーティング システムのバージョン名。
intprocessorCount: (読み取り専用) 現在のプロセッサの数。
intprocessorFrequency: (読み取り専用) プロセッサ周波数。
stringprocessorType: (読み取り専用) プロセッサの名前。
int supportRenderTargetCount: (読み取り専用) レンダリングでサポートされるターゲット テクスチャの数。
bool support2DArrayTextures: (読み取り専用) 2D 配列テクスチャをサポートするかどうか。
bool support3DTextures: (読み取り専用) 3D (ボリューム) テクスチャをサポートするかどうか。
bool supportAccelerometer: (読み取り専用) 加速度センサーの取得をサポートするかどうか。
bool supportAudio: (読み取り専用) 再生用のオーディオ デバイスの取得をサポートするかどうか。
bool supportComputeShaders: (読み取り専用) コンピューティング シェーダーをサポートするかどうか。
bool supportGyrscope: ジャイロスコープの取得をサポートするかどうか。
bool supportImageEffects: (読み取り専用) グラフィック効果をサポートするかどうか。
bool supportInstancing: (読み取り専用) インスタンス化された GPU の描画呼び出しをサポートするかどうか。
bool supportLocationService: 位置情報機能がサポートされているかどうか。
bool supportMotionVectors: モーション ベクトルをサポートするかどうか。
bool supportRawShadowDepthSampling: (読み取り専用) 影の深さをサポートするかどうか。
bool supportRenderTextures: (読み取り専用) レンダリング テクスチャをサポートするかどうか。
bool supportRenderToCubemap: (読み取り専用) キューブ テクスチャをサポートするかどうか。
bool supportShadows: (読み取り専用) 組み込みのシャドウをサポートするかどうか。
bool supportSparseTextures: (読み取り専用) スパース テクスチャをサポートするかどうか。
bool supportStencil: (読み取り専用) テンプレートのキャッシュをサポートするかどうか。
bool supportVibration: ユーザーのタッチ振動フィードバックをサポートするかどうか。
int systemMemorySize: (読み取り専用) システム メモリ サイズ。
string unsupportedIdentifier: 現在のデバイスで実行されている SystemInfo 属性値はサポートされていません。
SystemInfo クラスの関数:
bool SupportsRenderTextureFormat(RenderTextureFormat 形式);
レンダリング テクスチャ フォーマットを入力して、デバイスがこのフォーマットをサポートするかどうかを判断します。
 
bool SupportsTextureFormat(TextureFormat 形式);
テクスチャの形式を入力し、デバイスがこの形式をサポートしているかどうかを判断します。
Unity は、次のように機能コードの一部を実装します。
 
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class GetcpuNum: MonoBehaviour
{
    //指定输出文本框
    public UnityEngine.UI.Text messageText;

    //存储临时字符串
    System.Text.StringBuilder info = new System.Text.StringBuilder();

    // Use this for initialization
    void Start()
    {
        //将输出文本框置空
        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();

    }

    void GetMessage(params string[] str)
    {
        if(str.Length==2)

        {
            info.AppendLine(str[0]+":"+str[1]);
        }
    }  
}

実行結果:

 

おすすめ

転載: blog.csdn.net/u013774978/article/details/129847159