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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Re-size sprite by resolution

Discussion in '2D' started by GForce007, Oct 5, 2015.

  1. GForce007

    GForce007

    Joined:
    May 22, 2015
    Posts:
    27
    Hi All,

    Ok so I'm building my first FPS type game, and I've got all the basics in place.
    But now when I build and run my project, the sprites I'm using re-size and does not stay where I want them.

    The one I'm having most problems is my hud, in the picture attached you can see it.
    I want it to re-size etc. in all different resolutions.

    I'm a bit challenged mathematically so I don't really know where to start, also I don't know all the functions of unity, I'm a bit new.

    I'm using a perspective camera.

    Can you guys please help or point me in the right direction?

    Thanx!!!
     

    Attached Files:

  2. Lyker

    Lyker

    Joined:
    Feb 27, 2013
    Posts:
    60
    Have you tried making the HUD in the Unity UI features? It will use Textures instead of Sprites, which is basically the same, but imported differently. This feature will auto-resize textures on screen according to their anchor point.
     
  3. GForce007

    GForce007

    Joined:
    May 22, 2015
    Posts:
    27
    Hi, thanx.

    No, I haven't.
    How does that work?
     
  4. Lyker

    Lyker

    Joined:
    Feb 27, 2013
    Posts:
    60
  5. GForce007

    GForce007

    Joined:
    May 22, 2015
    Posts:
    27
    Thanx a lot, will take a look!!!
     
  6. GForce007

    GForce007

    Joined:
    May 22, 2015
    Posts:
    27
    Ok, I got it re-sizing perfectly now.
    But I can't seem to get sprites to render ontop of the canvas?

    Any thoughts?
     
  7. Lyker

    Lyker

    Joined:
    Feb 27, 2013
    Posts:
    60
    I haven't done this myself, but I think you could put the display mode on Screen Space - Camera, and then set a sorting layer.
     
  8. GForce007

    GForce007

    Joined:
    May 22, 2015
    Posts:
    27
    If you do that, the re-sizing properties goes away.
    I got a work around, I made "holes" in the canvas where I want my sprites.
    Not how I'd like to do it, but it works.