I know I can use Raycast to find what 3D object my cursor is over, but I also need to know if I am over a GUI Texture Object and if so, which one it is.
What do I need to use to return the GUI Texture object at Input.mousePosition?
I know I can use Raycast to find what 3D object my cursor is over, but I also need to know if I am over a GUI Texture Object and if so, which one it is.
What do I need to use to return the GUI Texture object at Input.mousePosition?
GUILayer.HitTest should help. Something like (attach to the camera):
var gui:GUILayer = GetComponent(GUILayer);
var element = gui.HitTest (Input.mousePosition);
if (element) {
// hit!
}
Or use OnMouseOver callback (this is not available on Unity iPhone though)
An alternative is to use the OnMouseOver callback (but it's not available on the iPhone, I believe)