- Home /
GUI.Button problem
Hi everybody. I have a problem with GUI.Button. In my game I have some scene. The problem I'm explaining here just occurs in one scene only. And here is the problem. I have a GUITexture as a background picture, and have some GUI.Buttons with different functions. But the problem is that the buttons aren't exactly on the background, I mean it is like the buttons are floating on the air. So when I click on them nothing happens. I must move a little and then click somewhere near them and then the button does what it is for. I mean it is like I have to click the shadow of the button on the background to make it work not the button itself. How can I make the buttons be on the background? I used GUI.depth for the buttons but it didn't work.
I hope I explane the problem clearly. Thanks

I put a picture of the situation, to show my problem. To color those white balls blue I must click the position of mouse cursor in the picture not on the blue pencil. Which is not what I want. I want if the player wants to color the balls blue clicks exactly on the blue pencil.
Answer by Berenger · Nov 22, 2012 at 10:40 AM
Unfortunately, Unity handle square buttons only, depending on the Rect. Check this thread, or anything related to round buttons.
I I used GUI.Button(rect) to create my button I just used pencil texture,(the texture is actually rect and the texture has some transparent part)
Your answer