- Home /
Any reason to use Unity's GUI paradigm if I'm working with sprite sheets and don't need GUI button presses?
I'm making an (effectively) 2d game that is using sprite sheets a.k.a atlases and I would like to continue to do so for my GUI textures. My GUI basically works like a classic arcade or Nintendo heads-up display. There is no mouse interaction, text input, or sliders / scroll bars.
Looking into the GUI and GUILayout classes, the only straightforward way I see to use a sprite sheet in Unity's built-in GUI paradigm is with GUI.DrawTextureWithTexCoords(). This just draws to an explicit location, using explicit UVs from your sheet.
I have infrastructure to work with sprites and their animations (within sheets) conveniently in main scene. For drawing the GUI on top, I can put the GUI sprites nearer the orthogonal camera (or maybe I'll set up an extra camera for explicit GUI draw order). Is there any reason I should still consider the built-in GUI classes or even use OnGUI()?
I personally wouldn't use Unity's GUI. Its slow. You should set up your GUI to render how everything else is in your game with the difference that the GUI elements are rendered last. Or as you mentioned, have the GUI elements a bit closer to the camera
Answer by Fattie · Jun 13, 2013 at 05:22 AM
Never use Unity's GUI for any reason. Ever. It's only a scratch development tool.
Just completely forget about it and pretend you never heard of it.
Note too that PlayerPrefs is a non-starter because it's not encrypted, grab Secured PlayerPrefs or write your own steganography wrapper.
Regarding 2.5D, everyone uses 2DToolkit or s similar product.
The time saving is unbelievable. It's not realistically possible to use Unity and not use 2DTK. (including in 3D projects where it's the only way to go for anything flat, buttons, signs, whatever.)
It has an extremely advanced sprite sheet management, including automatically doing low-res versions if you are working pixel-perfect, etc etc etc. You just drop PNGs in a folder and it's all done
Purchase 2DTK and all its competitors from the asset store, try them and decide which is for you.
(Note that TK now includes completely inherently "buttons" - very often this is all you will ever need for 90% of titles.)
Regarding GUI, many people use NGUI. This is just personal, but I don't like it. It has a learning curve, and for me the idea of spending time learning to "stick buttons in a game" is insane, but that's just me.** But again NGUI is incredibly popular and it may be for you, if you're project is one of those super-gui-related things. Again if you are doing some sort of gui-heavy thing, and you can't get another job ;-), buy NGUI and all competitors and decide which is best for your pipeline.
Regarding text. The only realistic pipeline for text in Unity is what is explained in the long comment here...
http://answers.unity3d.com/questions/384623/setting-font-size-according-to-screen-dpi.html
With that you can do anything, zero learning curve, any input from your design team, any typography, one draw call, what you see is what you get in the editor, and it's utterly proven and bug-free.
Regarding glowing and other lines on the screen, grab Vectrosity. If you need 3D letters, grab flying text 3D. For shape-shfting type things grab Mega-Fiers and the other products the same guys make.
Finally of course you'll use Prime31 every day, it's a basic part of development, the main middleware for games
Hope it helps in some way !
**making games for a living is the best job that has ever been, or will ever be, invented on this planet. the idea of having the job "making games for a living" and then spending more than 8 seconds "doing buttons" is a bit like being married to Gisele Bundchen or Ryan Gossling and then spending time, say, doing government paperwork. Let's get back to BLOWING STUFF UP ! :)
Your answer
Follow this Question
Related Questions
Having trouble changing sprites in 2 dimensional animation 1 Answer
How to make a sprite stay at a consistant baseline during animation? 1 Answer
Can you change the sprites of a 2d character rig (at runtime)? 1 Answer
Replace Sprite Sheet that's Already Animted? 0 Answers
Recoloring animated sprites [Solved] 2 Answers