Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Sprite Help Please

Discussion in '2D' started by KevG, Mar 27, 2016.

  1. KevG

    KevG

    Joined:
    Oct 4, 2015
    Posts:
    20
    Hi


    I have a 32x32 Sprite ( nothing much )

    Could someone point to a tutorial or explain what the pixels to units does ??
    Please see the following image of the Sprite details in the inspector panel arrowed in red.

    Thanks

    image.png
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,000
    KevG likes this.
  3. KevG

    KevG

    Joined:
    Oct 4, 2015
    Posts:
    20
    Thanks mgear

    So with my 32x32 Sprite, if I change pixels to units to 32 then my pixel will occupy 1 unity world unit, correct ??

    Now if this is correct does it effect what Sprite looks in the game view ??, ie will it appear stretched ??

    Thanks
     
  4. jc-drile77

    jc-drile77

    Joined:
    Jul 1, 2014
    Posts:
    229
    Yes, it will appear streched, the less pixel to units you put the bigger it will be.
     
    KevG likes this.
  5. KevG

    KevG

    Joined:
    Oct 4, 2015
    Posts:
    20
    Thanks Jc-drile77

    So is there a good tutorial on how to use this feature so that it doesn't appear stretched on the game screen ??
     
  6. jc-drile77

    jc-drile77

    Joined:
    Jul 1, 2014
    Posts:
    229
    100 pixel to units is the standard value, but sometimes you want some tiny sprites to be bigger withour modifying their gameObject´s transform in a scene, thats what it´s for.
    For instance if you set it to 25 is the same as having the gameobject (with the Sprite Renderer component) transform.scale set to (4,4,1).
    The way I see it is just about saving time and being able to fit a sprite to a game without having to resize it in external tools (that can make the sprite lose quality).
    Edit: Oh, and if you change it´s Pixel to Units every instance of that sprite will be changed too (is like resizing it without having to increase its size)
     
    theANMATOR2b and KevG like this.
  7. KevG

    KevG

    Joined:
    Oct 4, 2015
    Posts:
    20
    Thanks JP-drile77