Anyone know of a simple way to make a GUItexture not capture clicks, or rebroadcast the clicks?
Situation is as follows:
I have a game which uses both 2D and 3D objects that are clickable, and I want to use custom mouse cursors.
I assume that having a GUItexture following the mouse around means that any clicks will be sent to the mouse GUItexture object and not the the object the user intented to click. An effect which needs to be avoided of course.
I am aware that I can set up a custom system to handle mouse clicks my own way, but I am hoping to be able to skip that step.
Any ideas, hints, etc.?
Many thanks in advance!
Dan
You assumed wrong, i did a test and in 3D the event is sent to the first object the ray collides, but if you have a GUITexture over, the event is sent to the GUITexture AND the 3D object, so ignore the event on the GUITexture and you are done.
I plead guilty to not testing it. Will do so ASAP with the real question:
Does the same apply to multiple GUITExtures? Ie. will a GUI button still get a click if I have a custom cursor using a GUITexture? My guess now is that it does, but you never know.
And the answer is…no.
If you have a GUITexture as a custom cursor and attempt to capture clicks/etc. on other GUITexture objects, you have to do something manually.
Any ideas on how to circumvent this problem in the most easy/elegant manner?
And…the answer is: you set the layer of the GUITexture used as cursor to “ignore raycast”. Assumed (incorrectly) that the layer trick only works with 3D objects. It works for 2D stuff as well. Excellent!
Many thanks to…ME! Ok, then - thanks to you as well Omar!