Because of the need to obtain video card information, but Unity's own function, can only output 1 video cards
C # Yes, but referencing a downloaded DLL System.Management.dll
This DLL is not available for unity because Mono does not support
So first use vs write an external EXE program
usingSystem;usingSystem.Management; Public classsample{ Public Static voidMain (string[] args) { stringGname =""; ManagementObjectSearcher Objvide=NewManagementObjectSearcher ("SELECT * from Win32_VideoController"); foreach(ManagementObject objinchObjvide. Get ()) {Gname+= ("Name-"+ obj["Name"] +"</br>"); //System.Console.WriteLine ("name-" + obj["name"] + "</br>"); //System.Console.WriteLine ("DeviceID-" + obj["DeviceID"] + "</br>"); //System.Console.WriteLine ("AdapterRAM-" + obj["AdapterRAM"] + "</br>"); //System.Console.WriteLine ("AdapterDACType-" + obj["AdapterDACType"] + "</br>"); //System.Console.WriteLine ("monochrome-" + obj["monochrome"] + "</br>"); //System.Console.WriteLine ("installeddisplaydrivers-" + obj["installeddisplaydrivers"] + "</br>"); //System.Console.WriteLine ("driverversion-" + obj["driverversion"] + "</br>"); //System.Console.WriteLine ("videoprocessor-" + obj["videoprocessor"] + "</br>"); //System.Console.WriteLine ("videoarchitecture-" + obj["videoarchitecture"] + "</br>"); //System.Console.WriteLine ("Videomemorytype-" + obj["Videomemorytype"] + "</br>"); //Console.WriteLine ("=====================================================");} Console.WriteLine (Gname); Console.WriteLine ("====================================================="); //Console.readkey (); }}
Then build the run-down
Unity Code
usingSystem;usingSystem.Collections;usingSystem.Collections.Generic;usingSystem.Diagnostics;usingUnityengine; Public classGetsysteminfo:monobehaviour {stringA =""; //Use this for initialization voidStart () {//This method canGetstr (); //This method can also//Openexe ("C://Users/zts/source/repos/consoleapp9/consoleapp9/bin/debug/consoleapp9.exe "," "); } /// <summary> /// /// </summary> /// <param name= "_exepathname" >Path</param> /// <param name= "_exeargus" >Startup Parameters</param> Public voidOpenexe (string_exepathname,string_exeargus) { Try{Process myprocess=NewProcess (); ProcessStartInfo StartInfo=NewProcessStartInfo (_exepathname, _exeargus); Myprocess. StartInfo=StartInfo; Myprocess. Startinfo.createnowindow=true; Myprocess. Startinfo.useshellexecute=false; Myprocess. Startinfo.redirectstandardoutput=true; //myprocess. Startinfo.windowstyle = Processwindowstyle.hidden;myprocess. Start (); A+ = myprocess. Standardoutput.readline ();//only 1 rows can be readUnityEngine.Debug.Log (a); Myprocess. WaitForExit (); } Catch(Exception ex) {UnityEngine.Debug.Log ("cause of error:"+Ex. Message); } } Public voidGetstr () {Try{Process proc=NewProcess (); Proc. EnableRaisingEvents=false; Proc. Startinfo.filename="C://users/zts/source/repos/consoleapp9/consoleapp9/bin/debug/consoleapp9.exe"; Proc. Startinfo.createnowindow=true; Proc. Startinfo.useshellexecute=false; Proc. Startinfo.redirectstandardoutput=true; //Proc. Startinfo.windowstyle = System.Diagnostics.ProcessWindowStyle.Hidden;//this will get unity stuck .Proc. Start (); stringFingerprint =Proc. Standardoutput.readline (); UnityEngine.Debug.Log (fingerprint); Proc. WaitForExit (); } Catch(Exception) {Throw; } } /********************************unity Obtaining device information *******************************/ stringSystemInfo; Public voidGetunityinfo () {SystemInfo="\ttitle: Current system basic information: \ n Device Model:"+ Systeminfo.devicemodel +"\ n Device Name:"+ Systeminfo.devicename +"\ n Device Type:"+ Systeminfo.devicetype +"\ nthe device unique identifier:"+ Systeminfo.deviceuniqueidentifier +"\ nthe graphics card identifier:"+ Systeminfo.graphicsdeviceid +"\ nthe graphics device name:"+ Systeminfo.graphicsdevicename +"\ nthe graphics Manufacturer:"+ Systeminfo.graphicsdevicevendor +"\ nthe graphics card manufacturer ID:"+ Systeminfo.graphicsdevicevendorid +"\ nthe graphics support version:"+ Systeminfo.graphicsdeviceversion +"\ NAND Memory (M):"+ Systeminfo.graphicsmemorysize +"\ nthe graphics pixel fill rate (Megapixels/sec), 1 unknown fill rate:"+ Systeminfo.graphicspixelfillrate +"\ nthe graphics card supports shader levels:"+ Systeminfo.graphicsshaderlevel +"\ n supports maximum picture size:"+ Systeminfo.maxtexturesize +"\nnpotsupport:"+ Systeminfo.npotsupport +"\ nthe operating system:"+ Systeminfo.operatingsystem +"\NCPU Processing of cores:"+ Systeminfo.processorcount +"\ncpu Type:"+ Systeminfo.processortype +"\nsupportedrendertargetcount:"+ Systeminfo.supportedrendertargetcount +"\nsupports3dtextures:"+ Systeminfo.supports3dtextures +"\nsupportsaccelerometer:"+ Systeminfo.supportsaccelerometer +"\nsupportscomputeshaders:"+ Systeminfo.supportscomputeshaders +"\nsupportsgyroscope:"+ Systeminfo.supportsgyroscope +"\nsupportsimageeffects:"+ Systeminfo.supportsimageeffects +"\nsupportsinstancing:"+ systeminfo.supportsinstancing +"\nsupportslocationservice:"+ Systeminfo.supportslocationservice +"\nsupportsrendertextures:"+ Systeminfo.supportsrendertextures +"\nsupportsrendertocubemap:"+ Systeminfo.supportsrendertocubemap +"\nsupportsshadows:"+ Systeminfo.supportsshadows +"\nsupportssparsetextures:"+ Systeminfo.supportssparsetextures +"\nsupportsstencil:"+ Systeminfo.supportsstencil +"\nsupportsvertexprograms:"+ Systeminfo.supportsvertexprograms +"\nsupportsvibration:"+ Systeminfo.supportsvibration +"\ n Memory Size:"+systeminfo.systemmemorysize; } voidOngui () {Guilayout.label (systemInfo); } /************************************************************************/ //Update is called once per frame voidUpdate () {}}
Flaw: This kind of reading can only read 1 rows of data in the console, of course you can set the data together, one line output
I don't know if there's any other way to get multiple lines of console information
Unity reads external EXE program console information