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

Question Correct pixels per unit based on existing assets

Discussion in '2D' started by svprdga, Oct 6, 2021.

  1. svprdga

    svprdga

    Joined:
    Aug 21, 2012
    Posts:
    14
    Hello, in the current game I'm making I have:

    - A player, each sprite occupy 64 pixels
    - A tileset, each sprite occupy 16 pixels

    At first, I had the player configured with 100 pixels per unit and the tileset configured with 16. The tiles were incredibly big compared with the player.

    After tweaking, I have set:

    - The player configured with 16 pixels per unit
    - The tileset configured with 16 pixels per unit

    Now everything is scaled and works well, but I wanted to ask if this is the right way to configure stuff, or is there any other recommended setting based on the size of my assets?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,971
    Changing pixels per unit is a fine way to go, as is changing the scale of things in your scenes.

    I would try NOT to mix-and-match those things if at all possible, just because it makes a mess: Let's say today you decide to shrink your character down so you make him 50% in size. Tomorrow you decide to increase his size so you change the sprite pixels per world unit... now you have a real mess to figure out what is going on.
     
  3. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    The short answer is: yes, 16 is just right.

    The easy way to think about it is that PPU defines what 'one meter' is. If you create a 3D cube for example it'll have a scale of (1, 1, 1), meaning it's basically one meter in each direction (the value is pretty arbitrary, but as I said it's the easy way to think about it). So when you define a PPU of 16, that means that 16 pixels in your image are now one unit, meaning one meter. 32px would be two meters and so on.

    So by giving your tiles a PPU you basically say that one tile is 1x1 meters. And I'm guessing your character is somewhere between 16 and 32px high? Because that's what would make sense to me scale-wise and it's what most games do.
     
  4. svprdga

    svprdga

    Joined:
    Aug 21, 2012
    Posts:
    14
    Yes @Zephus, each tile is 16x16 and the character sprite is 64px, but there are empty space arround him, he's actually arround 32px high.

    Thanks for the help.