- Home /
HUD on Android/iPhone : GUITexture or OnGUI (drawTexture) ?
Hello !
I'm creating some games for Android/iPhone devices and I want to know which way is the best to do HUD : - Should I use GUITexture so I can create Atlas and reduce the number of draw calls - Or can I go with OnGUI and use drawTexture ? (can I use an atlas with OnGUI ?)
Thanks !
Answer by Silverfell 1 · Apr 26, 2011 at 03:29 AM
If you're designing for mobile, OnGUI is plain out. Every single OnGUI call is drawn with every frame, which effectively (in a best case scenario) doubles the load on the system.
If you design anything more complex than a couple of buttons, 20 OnGUI elements prove to be slower than 70-80 animated sprites (actual experience figures). Draw everything with GUITextures (or sprites), and track touches. GUITextures even have events to handle touch, so that should make them sexy once you wrap your head around their transforms.
Answer by Seantron 1 · Apr 20, 2011 at 04:29 AM
GUITexture is definitely the way to go on Mobile. OnGUI is not only not as easy to use, but it's way more expensive.
Test Prime31's GUISprite classes. They are all single draw call, and optimized very nicely.
https://github.com/prime31/P31UnityAddOns/tree/master/GUISpriteUI
Thx!
I'll take a look at it :)
PS : OnGUI is quite easy to use for me ^^
Yeah, OnGUI is easy to an extent (until you need them to do something they weren't intended to do), but if you want really nice looking GUI GUITextures are really the way to go. OnGUI is great for rapid prototyping, but you know. . . they look like a bad Flex app. Also, OnGUI isn't designed/optimized for mobile. But definitely try out those classes, they are great.
It seems that the author is rewritting the project, plus, I've read that it doesn't support text... I'm looking for other great HUD systems :)
Your answer
Follow this Question
Related Questions
[Question Duplicated] conversion of script guitexture to cube or other primitive (iphone) 0 Answers
Strange collision problem with block and terrain 1 Answer
Optimizing OnGUI - Too many gui elements? 2 Answers
OnGUI vs GUITexture for Tablets and Phones 2 Answers
conversion of script guitexture to cube or other primitive (iphone) 2 Answers