Search Unity

  1. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice

UI Image's mesh doesn't get updated when using a sprite from an atlas

Discussion in '2019.2 Beta' started by TFlippy, May 31, 2019.

Thread Status:
Not open for further replies.
  1. TFlippy


    Nov 12, 2014
    Nevermind, seems that this is fixed as of 2019.2.0b4.

    It appears that Image's mesh (e.g. shape, vertex colors) doesn't get updated when the used sprite is taken from a sprite atlas.

    The problem happens this way in my case:
    Inside a FixedUpdate, I'm changing UI Image's RectTransform's SizeDelta, Sprite and Color under certain conditions. The values do indeed get updated (according to Inspector), but the mesh doesn't.

    Changing the Sprite will keep texturing the old mesh, leading to some sprites having incorrect dimensions (e.g. mapping a 24x8 sprite, but the mesh is still same as the 8x8 sprite's) or having incorrect color.

    After I tried using only sprites that aren't defined inside sprite atlases, it started working correctly.
    Last edited: May 31, 2019
    Claytonious likes this.
Thread Status:
Not open for further replies.