- Home /
Check if mouse is over GUI element using Rendertexture?
My current setup:
I have a game scene, rendered by a default 3d camera. All GUI elements are 3d planes with textures, rendered to the main window, with a secondary orthografic camera.
What I'd like to do:
I want to check if the mouse position is over any GUI element. Not all of them have colliders, so normal raycasting would fail.
My Idea:
Is it possible to use the fact, that the secondary orthografic camera only renders GUI elements and clears with depth? Can I use Rendertextures and check for alpha values at a given xy position, or would that be too expensive? If yes, is it possible to render a camera to the main window AND a render texture?
Thanks for your help!
Answer by TheDarkVoid · Apr 20, 2012 at 08:16 PM
use the OnMouseEnter() this will work for anything with collier or is a GUI element
I dont have any colliders on the GUI objects. They're just GameObjects with (transparent) Textures.
Your answer
Follow this Question
Related Questions
dynamic hole in layer / texture / camera 0 Answers
Rendering different shader when camera get near object 1 Answer
Post Effect to certain objects? 1 Answer
Rendering on plane 1 Answer
How to get depth texture and render texture from one camera 0 Answers