Archive for August, 2013
I have been playing with input fields in NGUI and it didn’t seem very straightforward what each keyboard was, so I took a screenshot of every type accessible. Here they are:
As you can see, some are exactly the same (maybe they are different in portrait) so there is not as many options as it seems at first. I wish I could have done this for Android also, but I don’t have access to an Android tablet…
So when you build, sometimes it doesn’t take into account the new work you did. Or sometime it just gives you a weird error that you can’t figure out like this error “ArgumentException: get_temporaryCachePath can only be called from the main thread.”. Well maybe it’s time to clear the Unity player’s cache. But how do you do such a thing; there doesn’t seem to be any options settings in the player. Well, you could search for “Clear cache unity” in Google (that is probably what you search for to arrive to this blog post) or you could go directly to this link.
Well that is it, clear cache away!
Hey, I am working on a bigger post, but in the mean time, allow me to write this quick tip. In NGUI, when you don’t use an atlas for your sprites, you use the UITexture class. At first I was having so much trouble with it because the make pixel perfect button just didn’t seem to make my texture look pixel perfect. That was until I figured it out.
Making it work
When you select your texture file in Unity (the actual png file), the inspector will show you settings for it. By default, the type is set to ‘Texture’, which seems fine, but what you really want to be setting it at is ‘Advanced’. Than you will be able to change the next combobox. In 3D you want to have images (textures) that their width and height are powers of 2, example: 2, 4, 8, 16, 32, 64, 128, 512, 1024. When you do 2D (UI) that really never happens; never. That is why you will likely set the Non Power of 2 to ‘None’. That is the most important setting. Now when you will press Make Pixel Perfect button in NGUI, it will resize the texture to the correct size.
Figuring out compression
To be frank, I don’t totally understand the rest of the settings as they refer to 3D stuff, but by setting the Wrap Mode to ‘Clamp’, Filter Mode to ‘Trilinear’ and Aniso Level to ’4′ , your texture will look better at run time. Also, as you probably don’t need it, you should remove the check mark after Generate Mip Maps.
Well that is it for this quick tip, I hope it saved you some time when dealing with textures.