I’ve seen some pretty good examples of Unity being used in 2d games, and as a result I purchased Unity iPhone Basic. However, as I’m trying to learn the engine and investigating further, I find there is a total lack of any kind of sprite support outside of GUI calls. Reading around presents some third party addons like SpriteManager, but I think that it may be unneccessary for the kind of game I’m making, and also I’ve heard 1.5 adds sprite batching for non-animated sprites anyway. But this still doesn’t answer the basic questions of how to even create sprites. There seems to be no gameObject I can create to associate a sprite to, and putting a sprite texture on to a cube face with a texture produces incredibly blurry results.
So I ask, how are people making 2d games in Unity? How are they making sprites?
It’s actually the #1 thing I see Unity missing right now on the iPhone. You have to rely on 3rd party scripts and other methods to do it right now. Hopefully they have plans to add in a decent 2D system in the future. It really does leave out an entire class of games that could be handled by it.
I’d like to hear more about what zombieville usa did. That game does not feel like it’s 3d in any way, the textures animate nicely, etc. Is there a way to give artists the ability to do these animations, or is it done with some manual flipping of UVs through the code?
It’s very much 3D. Unity is a 3D engine; I don’t see them adding “real” 2D routines any time soon or ever. If they do, it would probably be a separate app, just because everything has to be handled completely differently. 100% of everything in Unity is textures on 3D objects (quads), including text, GUI elements, etc. Zombieville techniques discussed here, and possibly a couple other topics if you do a search.
That is true of all graphics systems (or the vast majority) over the past several years though. XNA for example actually has some decent sprite calls even though it is in reality a 3D api. All Unity needs to do is add SpriteManager like functionality (with decent UI elements) to the engine imho to get things started. It suprises me that they seem to ignore the 2D realm so much given what others do with it as an addition to their 3D capabilities. Even with a “3D game” the 2D UI elements are often just as important.
To be sure, they could certainly add some more “sprite-like” functionality using quads, but real 2D–as in standard bitmaps–is another matter and involves very different techniques.
The main problem I’m having is just that when you use a texture on a quad, you end up with something that’s being smoothed, if there was just a way to disable that I could write something to display “sprites”
There are many ways to skin this cat. We realize we could use some more convenient ways, but you can defenitely make great looking 2d games in the current version of Unity (see zombieville usa and many others).
Difficulties are roughly: Making sure to not get blurred textures, and having to write more than a few lines of code. For the blurred textures: make sure to use an ortographic camera for the 2d stuff, and offset your uv’s by half a pixel. (SpriteManager example does this for you, it’s a great place to start, or just use as a whole).
Hopefully some iphone devs will chime in with warstories on which methods they’ve found to be most effective for their projects.