Sprite texture size and padded size

While debugging a sprite shader I found a curious issue.

If I have a sprite that is not packed, its size gets padded to the next power of 2 size. This is expected.

If I do




I get the sprite width and height and not the padded texture size. eg a sprite that is 500x400 will give a texture size of 500x400 when the actual texture is 512x512.

Is there a way to get the true size of the texture?

not sure what do you mean by padded texture size, but i get right texture sizes with this code:

void Start () {
    SpriteRenderer sr = gameObject.GetComponent<SpriteRenderer> ();
    Debug.Log (sr.sprite.textureRect);