unity SystemInfo类 获得电量battery

我觉得用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

你可能感兴趣的:(unity SystemInfo类 获得电量battery)