unity SystemInfo类 获得电量battery

我觉得用Unity 开发最爽的地方, 不是unity跨平台,而是用其他语言,要用很复杂的逻辑才能完成的功能,unity用一两句代码就能搞定

就比如说获取Android 系统的电量,不用发广播,不用申请权限,一句 SystemInfo.batteryLevel 轻松搞定。

 

关于设备信息,我们可以通过 SystemInfo类 来获得

Static Properties

batteryLevel当前电量 (Read Only).
batteryStatus返回电池的状态,是否在充电等 (Read Only).
copyTextureSupport支持Graphics.CopyTexture的种类 (Read Only).
deviceModelThe model of the device (Read Only).
deviceNameThe user defined name of the device (Read Only).
deviceType返回本应用程序所正在运行的设备(Read Only).
deviceUniqueIdentifier返回设备的唯一标识符 (Read Only).
graphicsDeviceID图形设备的标识符
graphicsDeviceName图形设备的名称
graphicsDeviceTypeThe graphics API type used by the graphics device (Read Only).
graphicsDeviceVendorThe vendor of the graphics device (Read Only).
graphicsDeviceVendorIDThe identifier code of the graphics device vendor (Read Only).
graphicsDeviceVersionThe graphics API type and driver version used by the graphics device (Read Only).
graphicsMemorySizeAmount of video memory present (Read Only).
graphicsMultiThreadedIs graphics device using multi-threaded rendering (Read Only)?
graphicsShaderLevelGraphics device shader capability level (Read Only).
graphicsUVStartsAtTopReturns true if the texture UV coordinate convention for this platform has Y starting at the top of the image.
maxCubemapSizeMaximum Cubemap texture size (Read Only).
maxTextureSizeMaximum texture size (Read Only).
npotSupportWhat NPOT (non-power of two size) texture support does the GPU provide? (Read Only)
operatingSystemOperating system name with version (Read Only).
operatingSystemFamilyReturns the operating system family the game is running on (Read Only).
processorCountNumber of processors present (Read Only).
processorFrequencyProcessor frequency in MHz (Read Only).
processorTypeProcessor name (Read Only).
supportedRenderTargetCountHow many simultaneous render targets (MRTs) are supported? (Read Only)
supports2DArrayTexturesAre 2D Array textures supported? (Read Only)
supports3DRenderTexturesAre 3D (volume) RenderTextures supported? (Read Only)
supports3DTexturesAre 3D (volume) textures supported? (Read Only)
supportsAccelerometerIs an accelerometer available on the device?
supportsAudioIs there an Audio device available for playback?
supportsComputeShadersAre compute shaders supported? (Read Only)
supportsCubemapArrayTexturesAre Cubemap Array textures supported? (Read Only)
supportsGyroscopeIs a gyroscope available on the device?
supportsImageEffectsAre image effects supported? (Read Only)
supportsInstancingIs GPU draw call instancing supported? (Read Only)
supportsLocationServiceIs the device capable of reporting its location?
supportsMotionVectorsWhether motion vectors are supported on this platform.
supportsRawShadowDepthSamplingIs sampling raw depth from shadowmaps supported? (Read Only)
supportsRenderToCubemapAre cubemap render textures supported? (Read Only)
supportsShadowsAre built-in shadows supported? (Read Only)
supportsSparseTexturesAre sparse textures supported? (Read Only)
supportsVibration是否支持震动
systemMemorySize内存大小
unsupportedIdentifierValue 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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值