Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Tiled sprite with scale factor & anchor stretching does not work as expected

Discussion in 'UGUI & TextMesh Pro' started by TimK_personal, Oct 21, 2014.

  1. TimK_personal

    TimK_personal

    Joined:
    Jul 30, 2014
    Posts:
    18
    This is using beta 21 of 4.6. We have created a UI scene and added a tiled background. To adjust the size of the tiled elements, we applied a scale factor to the image, then anchored the image to the screen. However, this did not produce the desired effect:

    2014-10-20_1810.png

    I expected that the image component would anchor fully to the screen and the tiled texture would fill that. I can make that happen by manually resizing the image's rect, but then I end up with fixed offsets, so it is no longer screen size-independent.

    Is there another way to scale texture size without scaling the image component?

    (Demo project: https://bitbucket.org/MrTact/tiledemo)
     
  2. TimK_personal

    TimK_personal

    Joined:
    Jul 30, 2014
    Posts:
    18
    Quick and dirty answer to this: Change the pixels per unit import setting on the sprite to scale it as desired, then set the anchor offsets to 0.

    The proper way to solve it is probably to create the tiled sprite at the size where it looks right at native scale.
     
  3. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892