- Home /
iPhone Touch Screen?
Do I need to change all of my scripts to make it work for the iPhone? Or should it work anyways? These are the kind of scripts I am using:
function OnGUI () {
GUI.Box (Rect (350,200,190,150), "");
if (GUI.Button (Rect (360,210,170,30), "New Game")) { Application.LoadLevel (3); }
if (GUI.Button (Rect (360,250,170,30), "Level Select")) { Application.LoadLevel (1); }
if (GUI.Button (Rect (360,290,170,30), "Tutorial")) { Application.LoadLevel (2); }
}
Does this work on iPhone? Thx
Answer by jtbentley · Sep 08, 2010 at 06:32 AM
It will work - but it won't be fast. You should avoid all OnGui calls on iPhone for the sake of speed :)
Indeed it won't be fast at all. Here's an article with details... http://www.$$anonymous$$dthecube.com/blog/2010/09/avoiding-performance-cost-of-ongui
I've been using OnGUI for most of my menu and HUD in iPhone without much complaint. However, this is a very good article and I will certainly be rethinking my GUI approach.
Answer by MikezNesh · Jul 13, 2010 at 07:59 PM
It works.
Next time why don't you just try it instead of asking? (Unless you don't have it yet)
I don't have unity iPhone yet. I will get it when I finish. I know it works for PC, but didn't know if it would work on iPhone. Got it?
Your answer
Follow this Question
Related Questions
Touch GUI texture to toogle animation 0 Answers
[FIXED] Why is my GUI.Button always pressed? 0 Answers
Optimizing OnGUI - Too many gui elements? 2 Answers
Wrong Button touch? 1 Answer
GUI.DrawTexture on GUI.Button press 1 Answer