Ignoring raycast when touching GUI

I have a project where objects can be selected by touchscreen.
I’m using raycast for that, but i don’t want the object to be selected when i press a button on the GUI interface i made (if the object is under the GUI e.g.)
I tried checking for GUIUtility.hotControl value, but as far as i understand it only works with MouseDown event.

How can i make the raycast to ignore the objects under the GUI interface? (it’s an 500x80 sized solid panel)

You should check if one of the GUI rects contains the touch’s position before casting the ray. Can’t tell you if this is a best way, but it does work.