diff --git a/native/cocos/platform/interfaces/modules/XRCommon.h b/native/cocos/platform/interfaces/modules/XRCommon.h index 682c448c005..d33f2115081 100644 --- a/native/cocos/platform/interfaces/modules/XRCommon.h +++ b/native/cocos/platform/interfaces/modules/XRCommon.h @@ -120,6 +120,7 @@ enum class XRConfigKey { ASYNC_LOAD_ASSETS_IMAGE_RESULTS = 56, LEFT_CONTROLLER_ACTIVE = 57, RIGHT_CONTROLLER_ACTIVE= 58, + TS_EVENT_CALLBACK = 59, MAX_COUNT }; diff --git a/native/cocos/platform/java/modules/XRInterface.cpp b/native/cocos/platform/java/modules/XRInterface.cpp index b6224a9f137..b59f0447cfb 100644 --- a/native/cocos/platform/java/modules/XRInterface.cpp +++ b/native/cocos/platform/java/modules/XRInterface.cpp @@ -499,6 +499,11 @@ void XRInterface::initialize(void *javaVM, void *activity) { }); } else if (key == xr::XRConfigKey::ASYNC_LOAD_ASSETS_IMAGE && value.isInt()) { _isFlipPixelY = value.getInt() == static_cast(gfx::API::GLES3); + } else if (key == xr::XRConfigKey::TS_EVENT_CALLBACK) { + se::AutoHandleScope scope; + se::ValueArray args; + args.emplace_back(se::Value(value.getString())); + EventDispatcher::doDispatchJsEvent("onXREvent", args); } }); #if XR_OEM_PICO @@ -871,6 +876,7 @@ bool XRInterface::beginRenderEyeFrame(uint32_t eye) { #if CC_USE_XR if (IS_ENABLE_XR_LOG) CC_LOG_INFO("[XR] beginRenderEyeFrame %d", eye); if (_isEnabledEyeRenderJsCallback) { + se::AutoHandleScope scope; se::ValueArray args; args.emplace_back(se::Value(eye)); EventDispatcher::doDispatchJsEvent("onXREyeRenderBegin", args); @@ -895,6 +901,7 @@ bool XRInterface::endRenderEyeFrame(uint32_t eye) { #if CC_USE_XR if (IS_ENABLE_XR_LOG) CC_LOG_INFO("[XR] endRenderEyeFrame %d", eye); if (_isEnabledEyeRenderJsCallback) { + se::AutoHandleScope scope; se::ValueArray args; args.emplace_back(se::Value(eye)); EventDispatcher::doDispatchJsEvent("onXREyeRenderEnd", args);