Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

PSB's and Layer Positions

Discussion in '2D' started by AntLewis, Apr 8, 2021.

  1. AntLewis


    Feb 2, 2010
    Hey guys, I'm importing a PSB file from photoshop to Unity which is 1466x912. When it's being imported I'm using
    Code (CSharp):
    1. OnPostprocessSprites(Texture2D texture, Sprite[] sprites)
    so I can inspect the sprite data for each layer.

    When the PSB has imported, I drag it from the project window into the hierarchy. Each layer is a seperate object, has a local position and it all looks correct, but how does it calculate that local position? I assumed I'd be able to find this data in the sprite data but it's x and y co-ordinates seem completely wrong (though it's size and pivot are as expected). For example:
    • a layer/sprite that's 119x109 and is positioned in the top left of the image has an x position of 1478 and a y position of 121.
    • a layer/sprite that's 119x109 and is positioned in the bottom right of the image still has an x position of 1478 but a Y position of 472.
    It doesn't seem to make much sense....any ideas?