I have several GUI button images that look fine on Windows, but on the Mac are squeezed down to at most 50 pixels wide no matter what I do.
The buttons are all PNGs created with GIMP and a little transparency around the edges, and most of them display fine except for this one particular set of 384x128 images that I'm trying to display as 128x50:
When played in the Mac editor (and any builds created by it), it ends up being scrunched width-wise down to 50 pixels:
The code is essentially:
So far I have tried:
It thus seems to be independent of my code that's drawing it, and even overriding the GUIStyle. So far I'm not seeing a difference between the images it does it to and the rest that are displayed fine, so it's pretty whacked. Has anyone encountered this?
The problem seems to be limited to using an image as the GUIContent argument of GUI.Button, the workaround that ended up with acceptable results was just to make a totally new style for each button (a dozen in my case), and use the image as the "Normal" background of that style.
answered Jun 08 '12 at 01:05 AM
The reason is that you have set values for the button sizes. Instead use a dynamic size.
You will have to play with the sizes, but you get the idea. This way you will have the same relative size no matter what the screen size is.