Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Scale Spriteto fit screen portion

Discussion in 'Scripting' started by Sylon87, Oct 20, 2020.

  1. Sylon87

    Sylon87

    Joined:
    Aug 20, 2018
    Posts:
    196
    hello,
    i'm trying to scale a sprite to fit a screen portion ( 0.45f ) but i can't figure out how to rescale it, any help?
     
  2. VishwasGagrani

    VishwasGagrani

    Joined:
    May 12, 2018
    Posts:
    81
    You can make use of anchors. Check the unity guide for that.
     
  3. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    Is it a UI Image or a worldspace object with a Sprite Renderer?
     
  4. Sylon87

    Sylon87

    Joined:
    Aug 20, 2018
    Posts:
    196
    Worldspace object with sprite renderer inside a camera
     
  5. Sylon87

    Sylon87

    Joined:
    Aug 20, 2018
    Posts:
    196
    to be more clear i looking to have a the sprite that will be scaled to cover the area from 0 to 0.145 (it's 125x125 image so i need same width and same height ) and i'm using orthographiccamera