swiftsprite-kitspriteskspritenodesktexture

My SKTexture is size wrong for my SKSpriteNode


I have a 200 x 100 box-like menu button SKSpriteNode declared below.

menuBtn.size = CGSize(width: scrWidth * 1.5, height: 100)
menuBtn.texture = SKTexture(image: UIImage(named: "menuBtn")!)

The problem is, the hitbox for the button is still right, and the width of the SKTexture is fine, but the height of the SKTexture is around 1/2 the size of the actual menuBtn. It is a png, and I've checked and there's no clear textures around the sprite (just the transparent png ones), what am I doing wrong?

Pic of button: https://i.sstatic.net/LJhYg.jpg

Pic of button in App: https://i.sstatic.net/z12eE.jpg

Pic of how I want it to look: https://i.sstatic.net/cQL8h.jpg

The texture's png image size is 1044x1044 if that has any impact.


Solution

  • The problem I had was that there were extra transparent pixels in my base image, all I had to do was remove them with GIMP.