unity SystemInfo類 獲得電量battery

weixin_34104341發表於2020-04-07

我覺得用Unity 開發最爽的地方, 不是unity跨平臺,而是用其他語言,要用很複雜的邏輯才能完成的功能,unity用一兩句程式碼就能搞定

就比如說獲取Android 系統的電量,不用發廣播,不用申請許可權,一句 SystemInfo.batteryLevel 輕鬆搞定。

 

關於裝置資訊,我們可以通過 SystemInfo類 來獲得

Static Properties

batteryLevel 當前電量 (Read Only).
batteryStatus 返回電池的狀態,是否在充電等 (Read Only).
copyTextureSupport 支援Graphics.CopyTexture的種類 (Read Only).
deviceModel The model of the device (Read Only).
deviceName The user defined name of the device (Read Only).
deviceType 返回本應用程式所正在執行的裝置(Read Only).
deviceUniqueIdentifier 返回裝置的唯一識別符號 (Read Only).
graphicsDeviceID 圖形裝置的識別符號
graphicsDeviceName 圖形裝置的名稱
graphicsDeviceType The graphics API type used by the graphics device (Read Only).
graphicsDeviceVendor The vendor of the graphics device (Read Only).
graphicsDeviceVendorID The identifier code of the graphics device vendor (Read Only).
graphicsDeviceVersion The graphics API type and driver version used by the graphics device (Read Only).
graphicsMemorySize Amount of video memory present (Read Only).
graphicsMultiThreaded Is graphics device using multi-threaded rendering (Read Only)?
graphicsShaderLevel Graphics device shader capability level (Read Only).
graphicsUVStartsAtTop Returns true if the texture UV coordinate convention for this platform has Y starting at the top of the image.
maxCubemapSize Maximum Cubemap texture size (Read Only).
maxTextureSize Maximum texture size (Read Only).
npotSupport What NPOT (non-power of two size) texture support does the GPU provide? (Read Only)
operatingSystem Operating system name with version (Read Only).
operatingSystemFamily Returns the operating system family the game is running on (Read Only).
processorCount Number of processors present (Read Only).
processorFrequency Processor frequency in MHz (Read Only).
processorType Processor name (Read Only).
supportedRenderTargetCount How many simultaneous render targets (MRTs) are supported? (Read Only)
supports2DArrayTextures Are 2D Array textures supported? (Read Only)
supports3DRenderTextures Are 3D (volume) RenderTextures supported? (Read Only)
supports3DTextures Are 3D (volume) textures supported? (Read Only)
supportsAccelerometer Is an accelerometer available on the device?
supportsAudio Is there an Audio device available for playback?
supportsComputeShaders Are compute shaders supported? (Read Only)
supportsCubemapArrayTextures Are Cubemap Array textures supported? (Read Only)
supportsGyroscope Is a gyroscope available on the device?
supportsImageEffects Are image effects supported? (Read Only)
supportsInstancing Is GPU draw call instancing supported? (Read Only)
supportsLocationService Is the device capable of reporting its location?
supportsMotionVectors Whether motion vectors are supported on this platform.
supportsRawShadowDepthSampling Is sampling raw depth from shadowmaps supported? (Read Only)
supportsRenderToCubemap Are cubemap render textures supported? (Read Only)
supportsShadows Are built-in shadows supported? (Read Only)
supportsSparseTextures Are sparse textures supported? (Read Only)
supportsVibration 是否支援震動
systemMemorySize 記憶體大小
unsupportedIdentifier Value returned by SystemInfo string properties which are not supported on the current platform.
usesReversedZBuffer 如果當前平臺使用反向深度緩衝區(取值範圍從1附近的平面和0到遠平面),如果深度緩衝區是正常的(0在附近,1則遠),則此屬性為true。(只讀)

轉載於:https://www.cnblogs.com/Jason-c/p/7766647.html

相關文章