目录

GetControllerHandle

获取控制器句柄IControllerHandle,用于调用控制器相关的接口函数参考2.1.5.2 节 "IControllerHandle"。

Return Values

调用函数成功返回控制器句柄IControllerHandle,调用函数失败返回null。

该接口需要在Unity生命周期的Start()或其之后调用。

如需在非脚本线程或应用主线程中调用该接口,需要在调用该接口前将当前线程绑定到Java线程,并在不需要调用该接口后解除绑定。

Examples

IControllerHandle controllerHandle; //This variable related to the controller is used in the following codes.
controllerHandle = HvrApi.GetControllerHandle();
if (controllerHandle != null) {
    Debug.Log("GetControllerHandle Success!");
} else {
    Debug.Log("GetControllerHandle Failed!");
}