Working with Sprites

Hey people

I have some rather complex data i want to port to Unity. Basically its one file containing the actual sprite data (this could be several assets in one file), another containing coordinates of the sprites and finally a file containing palette data.
Now I am in doubt on how to approach it, basically I could probably drag in all the files and do a C sharp script to parse it into something meaningful or I could do an external script that would create single assets that I could just import.

The latter would be less effective but be more in thread in how the visual part of Unity work. Basically I could use some hints, what would work the best within Unity?

You actually wouldn’t need an external script to bring your assets in. I’m not sure exactly how your sprites are set up at the current stage, but Unity there are multiple ways of combining individual images into a sprite atlas. That is also the most performance optimized way- a single large sprite sheet. There are some on the community wiki, and you could see the one I use, but that one requires that all the sprites be the same size.

Sprite sheets are usually the best way to go. You could have individual images, and it would work fine, but your performance would not be as good.

Sprite manager (SM) 1 or 2 is considered Unity’s most effective sprite managing script at the moment by most people so if you are willing to give over some cash, then that is the easiest way.

As far as showing images on a sprite sheet, the two most common ways in Unity are to animate the uv’s of your sprite to fit the image, or to scale and offset the texture so that only a part is shown. I believe that SM uses the uv’s method. That way lets you use more irregularly shaped sprites, but the performance is not nearly as fast because Unity has to recreate the uv data every frame which is more costly than offsetting a texture.

Peter…
Thankyou for your reply.

I should probably clarify that when I say sprite, its actually single images on a big sheet, here is no animation involved. The index file tells the dimensions and position of each image.

Since I am creating a mobile application, a single sprite sheet with all my information would then be the most efficient?. There is about 5000 assets but I will not need all of them.

I will have a look at Sprite Manager

Ok. That works just as well. Since you are not animating sprites, modifying the planes uvs should work fine for you without any performance issues. You can pack these sprite sheets in Unity using a custom algorithm or Texture2D.PackTextures and it will return an array of rectangles that you can use to store the uv coords.