How does one author 2D games in unity?

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?

there is no such thing as sprite or 2D tech unless you implement it.

The Sprite Manager is likely the easiest way to go.

Distinct game objects with custom UVed quads you dynamically created that use the same texture but different areas are the other.

on top of that there is the option to all do in the modelling app and move around bones as it was done in zombieville.

but independent of the way you do it, its programming to 100%, there is no 2D editor and 2D features to just “use”.

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.

–Eric

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.

–Eric

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”

Hey,

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).

There’s roughly three techniques you could use:

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.

Hope this helps,

Lucas

I’m a guiTexture whore when it comes to 2D… Works a treat :slight_smile:

I built Al Lowe’s Cyberjokes with only guitextures, built my own button animation system etc (its all extremely reusable code) etc etc.

Takes me less than 20 seconds to put in a new page with animated buttons that all function properly… Very happy with how it all turned out.