Search code examples
unity-game-engineunityscript

unity | disable eventsystem module input for one gameobject


I have a eventsystem with 2 inputmodules (gaze (for cardboard) and touch). The gazeinput is above de touchinput, so that is going to be used by unity as main inputmodule. Now i have 1 object that i want to trigger on touchinput, but that is not working because of the gazeinput. So my question is if it is possible to disable the gazeinput just for this 1 gameobject?

EDIT: the object is a menu button, located in the bottom-right corner. It moves with the camera.

thanks


Solution

  • use raycast. when your camera is seeing the gameobject on which you want to use the touch input. detect that the user is looking at the camera via raycast.

    Attach a script (to the camera or an empty gameobject) that has the reference of both the input modules

    When the player looks at the object(detected through raycast) in which you want to use the touch input. Simply disable the gazeinput.

    And when the player looks away from that gameObject enable the gazeinput