Sprite Borders + Mip maps issue on iOS (RC3)

Just incase you’re wondering why slicing isn’t showing you what you expect check you do not have the following set of circumstances as it appears that there is an issue with the following:

  • Build platform is set to iOS
  • Non power of 2 sprite
  • Mip maps enabled
  • Sprite part of sprite packer atlas (allowing use of non square mip mapped sprites)
  • Use sprite in an image with Tiling or Slicing

As you can see below the image does not tile properly and gains an area of white (highlighted) not present in the atlas. Looking into this further and it is evident that the editor is using a padded non atlased sprite while in edit mode.


I added the following script to show the UVs used by the Image component and in the right hand column of the above image you can see that the inner UVs are being reported outside of the outer UVs. It appears the outer UVs are correct for the padded sprite but the inner UVs are for a non padded sprite.

using UnityEngine;
using System.Collections;
public class ShowBounds : MonoBehaviour {

    public Sprite sprite;
    public Vector4 inner;
    public Vector4 outer;
    void OnValidate ()
    {
        if(sprite != null)
        {          
            inner = UnityEngine.Sprites.DataUtility.GetInnerUV(sprite);
            outer = UnityEngine.Sprites.DataUtility.GetOuterUV(sprite);
        }
    }
}

Fortunately when you switch to play mode or switch the platform to PC or Mac both UVs change to match the position in the atlas and everything is rendered correctly. But this does mean that if you make use of mip maps and non power of two textures you can not edit while the platform is set to iOS.

A quick update. I’ve just been creating builds and Unity managed to get into a state where builds and running in editor kept the bad inner uvs for the texture! I ‘fixed’ it by deleting the library folder and hence forcing Unity to recreate it’s cached data. Perhaps I could have tried repack, if it occurs again I will.

Bug submitted as case 650986

Sorry it took so long but we will have this fixed in a patch release shortly.

1 Like

Thanks this is great news, hope we see this working next patch.

Fantastic news, Its been a real pain having to constantly switch platforms between pc/mac and mobile, I assume you spotted that the issue also occurs with the platform set to Android on a PC.

It was a cross-platform fix.

1 Like