How to add click action to cursor in hololens

本小妞迷上赌 提交于 2019-12-06 09:02:28

问题


In microsoft hololens ,Added cursor to a button but unable add cursor action ,can anyone help Thanks in advance.


回答1:


To add the ability to "click" you can do this with the Input Manager that is built into the HoloLens Toolkit. See here:

https://github.com/Microsoft/HoloToolkit-Unity/tree/master/Assets/HoloToolkit/Input

Specifically you should add the InputManager prefab to your scene, then add to a script that is attached to an object an implementation of IInputClickHandler. So something like this:

public class DoSomethingOnClick : MonoBehaviour, IInputClickHandler
{
     void IInputClickHandler.OnInputClicked(InputEventData eventData)
    {
         // A Click happened here, do something about it
    }
}



回答2:


Make sure you dont forget to have an event system in your scene.



来源:https://stackoverflow.com/questions/41689958/how-to-add-click-action-to-cursor-in-hololens

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!