Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Best practices when it comes to Importing 2D pixel sprites into unity

Discussion in '2D' started by ianmcelvain, Jun 21, 2015.

  1. ianmcelvain

    ianmcelvain

    Joined:
    Jan 28, 2014
    Posts:
    37
    (Using Unity 5.1.1)

    Hi guys, my name is Ian and I'm familiar with programming and all that jazz just new at Unity and its UI. I am developing a game (Name is 'Emortuus') its a 2D platformer and i have the core of the game actually complete and written down now i just need to construct it in a software and instead of using what i usually use I wanted to try Unity and see if i can take advantage of its awesome easy to use features. Now, i have all my sprites made character wise and some level models but I would like to know from experienced users of Unity any good 'Practices' i should be using so my brain doesnt hurt later down the road.

    heres a pic of the character models (defined pixel art) for you to get what im working with:


    -So when making sprites whether it be a sprite sheet for a characters run/idle/jump anim, a single item (maybe like a trash can that will sit on the side of the road) or a big BG for my game scene what dimensions should i make it in that is easy for unity to translate/compress, eg: 256x256, 512x512. does this matter?

    -My next concern was with the Pixel to Units. I was watching some YouTube videos by Brackeys who seems to understand the UI of unity a lot and when i was watching the importing tut he would change the value of the pixels to units frequently but doesnt define what it does exactly other than the obvious (changes sprite size) but if you change the pixel to units for most of your sprites just so you can make sure it fits well with everything in the scene will it disrupt how the game flows? I will be using the engines self provided physic scripts as long with other tweaked up ones, ive read that changing the pixel to units can also change to outcome of the physic scripts in unity.

    -The max size (also under import setting) also concerns me. This is where i thought i'd worry about the dimensions of my sprites should be when importing them into Unity. Should i have all my sprites being able to be on 1024 or 2048 or does it really matter. Say if i had just an oddball dimension like 270x270 what would I do in this situation dealing with the 'max size' option. This also leads onto should i practice a more practical approach and just stick to a couple different dimensions that are already listed in Unity like 256x256, 512x512, ect...

    -Now I understand some of you guys are probably shaking your heads while reading this and I apologize its just that im relatively new to the UI especially on importing things (i have programmed C# in Unity, very easy UI in that part). This is a big game and me being a perfectionist I would like to know exactly what the import settings can change in the game because so far its been giving me headaches and would just like to know the best practices when it comes to importing 2D pixel sprites into unity and running it efficiently as possible.


    Summary: Basically need to know a good practice on importing 2d pixel sprites into Unity.
    -What dimensions are best when making them in Photoshop then importing them into unity so it can compress it better.
    -Pixels to units : how should i go about with this tool when importing.
    -Max size: This also goes with what dimensions i should use with my sprites.

    Thank you guys.
    Sorry if posted under wrong section.
     
    TempestMia likes this.
  2. ianmcelvain

    ianmcelvain

    Joined:
    Jan 28, 2014
    Posts:
    37
  3. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    • When importing textures, the image width and height should ideally be in powers of two if possible, e.g. 256, 512.
    • Certain platforms might not be able to handle extremely large texture sizes, so depending on your target platforms you might want to have smaller sizes for your spritesheets.
    • For compression, you could try setting the format to Crunched and setting the compression quality to the highest in Import Settings.
    • This blog post might help with Pixels to Unit.
     
  4. Shadeless

    Shadeless

    Joined:
    Jul 22, 2013
    Posts:
    136
    A Pixel Per Unit ratio that works for me is a value of 10. Don't ask me why, it's a magic number that the camera likes if you have a moving camera.

    I set the Snapping Settings to 0.1 and use CTRL to position stuff around. And I make sure all my transforms positions have one decimal point. So If had 56.236 I set it to 56.2.
     
    theANMATOR2b likes this.
  5. trialforce

    trialforce

    Joined:
    Apr 15, 2012
    Posts:
    22
    Interesting!

    Unity should have a way to avoid 56.236 2D games , huh?

    Perhaps a simple script would solve it?