Hololens UGUI
post by:追风剑情 2023-2-15 14:21
设置Canvas
-
点击 "Convert to MRTK Canvas"
-
点击 "Add NearInteractionTouchableUnityUI"
-
将RectTransform的Scale设置为(0.001, 0.001, 0.001)
参考示例
-
Canvas的Render Mode要选择World Space
-
添加CanvasUtility脚本,此脚本会在运行时设置事件相机。
canvas.worldCamera = CoreServices.InputSystem?.FocusProvider?.UIRaycastCamera;
-
添加NearInteractionTouchableUnityUI脚本,Events To Receive选择Pointer,Debounce Threshold设置为0.01
-
同理,如果需要其它UGUI组件支持靠近交互,需要在UGUI元素上添加NearInteractionTouchableUnityUI脚本,Events To Receive选择Pointer,Debounce Threshold设置为0.01
评论:
发表评论: