Set scale value of a sprite to match with size (with, height) of an image?

Hi everyone, I have a image which has size (width x height) = 170 x 192. Then I wanna create a GameObject with a srpite component which has the same texture as the image.
But there is a problem that I can’t find the formula to scale the gameobject based on the image size.

Any suggestions?
Thanks for reading :slight_smile:

You can get the pixel size of the sprite and divide it by “pixels per unit” value to get its size in scene units:

Vector2 GetSpriteSize(Sprite sprite) {
    return new Vector2(
        sprite.texture.width / sprite.pixelsPerUnit,
        sprite.texture.height / sprite.pixelsPerUnit);

am a little curious about the solution.
Can you please update what you did ?