- Home /
If-statement on GUI.Button won't work on Android
My last thread was closed cause of a duplicate i deleted before it was closed, so I try again..
I just tried to launch a game for Android-devices, but I got a major bugger that won't launch the game. As the title say, the if-statement for a GUI.Button to start the game won't work, it just stand on the same scene without doing anything. Is it a quick way to solve this? if(GUI.Button(new Rect(450,350,500,100),"Start game")) { Application.LoadLevel(1); }
IN THE UNITY APPLICATION
OPEN "P{LAYER PREFERENCES"
LOO$$anonymous$$ AT THE$$anonymous$$
HAVE YOU FORGOTTEN TO INCLUDE THE RELEVANT SCENES ?
This is the third time someone has explained this
post a SCREEN SHOT of your player preferences "scenes in build"
new Rect(450,350,500,100)
this sounds quite big to me for a mobile.
https://dl.dropboxusercontent.com/u/4938568/Screens/ScreenShot052.png
Everything is included and it works fine when I run it in unity and on the unity remote app for android.
Also, make sure you do not hide useful members. You have a warning that tells you you are doing wrong.
How about a logcat? $$anonymous$$aybe you are getting some exception message? Just as a total sane check, also headbutt an Debug.Log in there to ensure the code is actually being called.
Answer by Fattie · Apr 30, 2013 at 12:52 PM
"the unity remote app......"
the remote app is utterly unrelated. it's just a mirror of your desk machine's screen.
You are using sizes too large - exactly as Fafase told you.
make it much smaller, try again, and let us know.
What I recommend is to use ratio.
Use Screen.height/ratio and Screen.width/ratio. This way you don't have to do one code for mobile phone, one other for tabs and even for each phone size you would have to...well you get the idea.
Using ratio, your box automatically gets sized according to the screen. You would have your font size doing the same as well (using integers).
Your answer
Follow this Question
Related Questions
Press Back Button Twice to Quit Game 0 Answers
touch GUITexture Help 1 Answer