Now either Unity3D is full of Bugs or I am missing something simple. The Texture versus the Touch event do not even remotely line up to the same position to fire off an event. Using a simple pair of 32x32 images to invoke seperate events but the input position seems to be miles away even when I do a contain.
NOTE: Not using Event.current.mousePosition as it is for a single input event and using two fingers on a mobile and not one. Also, Guitexture is not an option for this since i'm using the ultimate FPS camera and it hates guitextures.
So actually I think your code for the detection would be fine if it wasn't in OnGUI. Given that you could store the rectangles as private vars rather than local variables you could draw your textures in OnGUI and actually detect your collisions in Update().
answered Jun 02 '12 at 12:42 AM
Well, i know this is a little old post, but i think it worth to answer this, since I have been searching a lot to find this answer.
Your first code works fine, you need to take out your code for detection as whydoidoit suggested, but there is one little thing that is missed there, you need to substract the fingerPos.y form Screen.height (after searching, the touch position in the y axis is flipped or backwards in respect to screen.height), the code would be something like this:
Hope this would help someone.
answered Mar 02 at 04:50 AM