- Home /
GUIButton won't appear Scripting problem, help?
function OnGUI() {
if (GUI.Button(new Rect(Screen.width - 100,Screen.height-35,350,50),"SoundCloud!")) { Application.OpenURL("https://soundcloud.com"); }
}
wheres the problem here??
Thanks!
didn't see this one, sorry for the lack of description, i've got a GUI button bottom left which opens facebook (browser version) and it fits perfectly, half way across the screen but when i try and create a button for the right hand side it doesn't show, there's no messages stating that the script is incorrect, so im guessing its positioning is out of the way but because i'm new at this im not entirely sure what the coordinates should be?
can i see the code, that you have written before this code? may b some error there...
the code supplied in the original post is the original code
can you format your code you have 010101 up there and afaik you need to have script on your camera
Answer by robertbu · Mar 18, 2013 at 03:54 PM
Your rect is just about off the screen. You can see a piece of your button in the lower right corner of the screen. Try this for your rect:
Rect(Screen.width/2 - 100,Screen.height/2-35,350,50
thanks for the reply robertbu but unfortunately that didn't work =[ i already have the following for another link (bottom left) and it works and fits perfectly.
function OnGUI() {
if (GUI.Button(new Rect(0,Screen.height - 100,350,100),"Facebook!")) { Application.OpenURL("https://www.facebook.com") ;}
}
So you want it on the bottom right? Your Rect should be:
Rect(Screen.width - 350,Screen.height-50,350,50);
yeah sorry about that, i forgot to mention it, i did originally in the original post but then edited it and deleted it. and again unfortunately that didnt work, i cant even understand why...im testing on a Samsung GS3, to reiterate, left works as above ^ ^ but right doesnt =/
Answer by ajohnson1910 · Mar 18, 2013 at 08:13 PM
I've tried moving the bottom-left to top-left...works perfectly but bottom-right to top-right...nothing! even when rotating the screen nothing shows up for the right hand button!