Hello Guest

Author Topic: how to get Sprite height and width?  (Read 8611 times)

Tongie

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 23
    • View Profile
how to get Sprite height and width?
« on: January 17, 2013, 02:23:26 pm »
how do i get the the height and width of my jpeg or png file in unity?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: how to get Sprite height and width?
« Reply #1 on: January 17, 2013, 04:26:24 pm »
You can get the physical world space sprite height and width by getting the renderer bounds. You can also get the sprites local bounds by calling sprite.GetBounds (http://unikronsoftware.com/2dtoolkit/doc/html/classtk2d_base_sprite.html#abc5d84fc4f1158dad2c8e180ebb21538) and sprite.GetUntrimmedBounds (http://unikronsoftware.com/2dtoolkit/doc/html/classtk2d_base_sprite.html#a738ea31c3a243e7249bdea2ac5c84eb9).

Tongie

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: how to get Sprite height and width?
« Reply #2 on: January 18, 2013, 03:21:31 am »
thanks got it to work...