Search Unity

My UIImage doesnt scale properly

Discussion in 'Scripting' started by AHMADF000, Jun 24, 2019.

  1. AHMADF000

    AHMADF000

    Joined:
    Oct 17, 2017
    Posts:
    36
    i have a UI image that i use for border, but it doesn't scale properly,
    the image is 16:9, 9 sliced, and tiled

    this is 16:9
    1.PNG

    this is 4:3
    2.PNG
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    What is your canvas scaling set as?
    What is your image recttransforms settings at?

    You need to have these things setup correctly if you want the image to stretch properly on different size screens.
     
  3. AHMADF000

    AHMADF000

    Joined:
    Oct 17, 2017
    Posts:
    36
    By canvas scaling do you mean UI Scale Mode? i set it to Scale With Screen Size

    This my image rect transform
    3.PNG
     
  4. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    So your image isn't set to stretch, so it doesn't change with screen size. It's just centered.

    You'll also probably need to make sure your scale resolution on the canvas is correct.

    But for the image, where you see that thing that looks like a target, change it to stretch with height and width.
     
  5. AHMADF000

    AHMADF000

    Joined:
    Oct 17, 2017
    Posts:
    36
    Yes, forgot about that
    thanks for the help!