Unity: Easy mistakes to make: NPOT GUI textures scaled to POT

If you import non-square images into Unity 3 it automatically sets the texture import setting Non Power of Two to ToNearest. This will cause your image to be scaled to fit the nearest power-of-two dimensions. Now it can be compressed – yay! Or wait… If you want to use for a button or box or something in a GUISkin, then this will break your GUISkin since your carefully measured values will no longer be valid and it might not be immediately obvious why it looks wrong…
Well, you could deliberately set them to a certain POT size and calculate values that would work with that size, but I’ll always prefer uncompressed GUI images over compressed once. (or at least until memory runs out…)
Note to self: Add to list of things to do once I retire: Write a script that automatically calculates and adjusts the border values of all elements where a NPOT image has been scaled to a POT.
Bookmark the permalink. Follow any comments here with the RSS feed for this post. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>