Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    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

    TFlippy

    Joined:
    Nov 12, 2014
    Posts:
    27
    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.