Search Unity

4.3 Atlas Files

Discussion in '2D' started by Redkwind, Nov 21, 2013.

  1. Redkwind

    Redkwind

    Joined:
    Nov 21, 2013
    Posts:
    11
    So, im pretty new working in Unity but i have been doing some experiments for 2d games.
    I was working with Orthello 2d and now that the 4.3 is out i would like to port my work into this new way to do it.

    I would like to know if there is any kind of tutorials or documentation to better understand how Unity manages the 2d now... Because after watching the video where they show the demo project i still have many questions.

    One of those if you can help me is...

    How am i supposed to pack the sprites without the pro version?

    Before, i was using the Texture Packer but im working with irregular sprites that change their width and height so when i try to animate them on Unity 4.3 they jump around the screen... apparently it has to do something with the anchor and the center of the sprite but i don't know how to fix it. (if i set the anchor to the bottom it only moves horizontally ... partially fixing the problem).

    This is my sprite (see image below)... and its packed with the free version of the Texture Packer. When i slice it in Unity, it works good.. it finds and selects every sprite individually but when i try to create the clip animation, due to the different sizes the sprite seems to be jumping all over the place.


    I would appreciate any pointers on how to get this kind of sprites to work properly.
    Thanks.
     
  2. sotirosn

    sotirosn

    Joined:
    Jan 5, 2013
    Posts:
    24
    Set the anchor (Pivot in the sprite editor) to 'custom'.
     
  3. Redkwind

    Redkwind

    Joined:
    Nov 21, 2013
    Posts:
    11
    This gave me the same results but in a different direction.

    Im guessing i will have to manually adjust every anchor to its frame, which inst optimal for what i need to do (tons of sprites).
     
  4. Saxi

    Saxi

    Joined:
    Jun 28, 2013
    Posts:
    381
    Without using something like 2D Toolkit, I think you are going to have to add enough whitespace so they all are the same square size. Then use grid to grab them. Or slice by hand. You can't use many of the features of Texture Packer with Unity without some sort of "agent" in Unity to rebuild what you do. I haven't tried the Texture Packer Pro plugin released by a third party, I believe that allows you to use trim but not sure what else it does.
     
  5. TomasJ

    TomasJ

    Joined:
    Sep 26, 2010
    Posts:
    256
    If you are using an external application to pack your sprites and it doesn't fit on a grid, you will have to export some metadata from that application to know where the pivot point is. Then you can load it up in Unity, parse with an editor script and adjust the pivot points.
     
  6. Redkwind

    Redkwind

    Joined:
    Nov 21, 2013
    Posts:
    11
    This is actually a great idea.
    I use Sprite Packer (free version) that contains a xml (plist) file to store some metadata...but i didnt see it storing a pivot point. I will have to check more carefully.

    I was wondering how Orthello 2d did the trick and im guessing they have a script like that. Now, when should i use that script... since the sprite is created in the editor... i dont think running it at runtime is a good idea. o_O

    Im sorry if my questions are dumb but im pretty new to unity.
     
  7. Spinnernicholas

    Spinnernicholas

    Joined:
    Jan 24, 2013
    Posts:
    125
    This was something I came up with to answer a similar question someone else had.