Pico企业版获取头盔电量
Function
|
Description
|
Initializes the enterprise service for a specified object. Must be called before calling other enterprise APIs.
|
|
Binds the enterprise service. Must be called before calling other system related functions.
|
Gets the specified type of device information.
|
但是在使用BNGFrameWork框架后,Pico Integration中没有勾选pico选项,所以宏命令没有PVR_XXX的命名空间一直会报错。
查阅了官方SDK后,得到了一个新的解决方案
PXR_Enterprise.InitEnterpriseService();
PXR_Enterprise.BindEnterpriseService();
这两个函数必须要在调用企业版SDK的相关设备信息函数前调用。
调用初始化和绑定函数后,通过PXR_Enterprise.StateGetDeviceInfo(SystemInfoEnum.ELECTRIC_QUANTITY)
返回值就是电量的字符串类型。
*注意!直接在Start/Awake中进行这一套初始化、绑定、获取设备信息流程可能会获取失败,返回空字符串。获取信息建议做一个协程等待,或者在合适机会获取