1

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

Gerald_LD
  • 101
  • 1
  • 8
  • Possible duplicate of [How do I enable Parts/Components in Unity C# with only a game object in the script](http://stackoverflow.com/questions/31993266/how-do-i-enable-parts-components-in-unity-c-sharp-with-only-a-game-object-in-the) – Fattie Feb 23 '16 at 11:31
  • If i'm not mistaking this thread is for disabling child parts/components of a gameobject. But I need exclude a (game)object from an specific eventsystem but make it accessible for a second eventsystem. – Gerald_LD Feb 29 '16 at 13:26

1 Answers1

0

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

WajeehHassan
  • 526
  • 1
  • 3
  • 9
  • Hello, sorry for the late responce! I now see that I wrote my question wrong. Your answer is indeed the solution to the above question. But in my case, the object is an 2d menu button (placed in the bottom-right corner) that moves with the camera. So Raycasting isn't an option. Do you have a solution to that too maybe? – Gerald_LD Feb 29 '16 at 13:19
  • (1) if the above answer is correct for the question asked, please tick it. (2) Do not hesitate to ask a new question. – Fattie Feb 29 '16 at 13:29
  • Edit: You can use a dot or a point at the center of the camera and check it against the x and y position of the button – WajeehHassan Mar 02 '16 at 11:32