- Home /
GUITexture click detection problem
I've run into a very odd problem. I want to make a GUITexture clickable as a button. Sounds easy? Just add the an OnMouseUp function to it and its done?
Well, the problem is that no matter what I do only the far left part of the texture is clickable. Nothing else. I cant figure out whats wrong. I simply Create GUITexture, and add a script that has nothing but the OnMouseUp function that prints "Click" to the console. Thats all.
I ialso find it odd that when I create the GUITexture the handles arent in the centre of it, but off to the left... thats normal?
Edit: Okay, it seems the problem appears because I use two cameras to split the screen verically... So the question would be, how to make GUITextures work with two cameras?
Answer by Eric5h5 · Oct 20, 2012 at 08:03 PM
Make a third camera that covers the entire screen, is drawn on top of the other cameras, and only displays GUI elements. The other two cameras should not have a GUI layer component.
Aha, that works! Although I am having trouble displaying the other two cameras though. It seems to work when I set the GUI camera clear flags to "dont clear". However the documentation says its not a setting usually used... Thats the right way to do it?
Thanks. And thanks again for the quick replies. Everything works fine now!
Your answer
![](https://koobas.hobune.stream/wayback/20220613082652im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
GUITexture Button? 1 Answer
GUILayer hit doesn't work. Any help? 0 Answers
Changing Font, Background/Style of GUI Buttons 1 Answer
GUI Texture Problem 3 Answers
Create GUI Texture using GUI Layout 2 Answers