Search Unity

Adding image to canvas (ui) is not working...

Discussion in 'Getting Started' started by NoobieNoob, Apr 1, 2015.

  1. NoobieNoob

    NoobieNoob

    Joined:
    Feb 18, 2015
    Posts:
    26
    Hi
    I added canvas and in it added a image, but I am not being able to but my jpeg image in the field


    What should I do?
     
  2. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,191
    Have you checked that it is the correct format?
     
  3. NoobieNoob

    NoobieNoob

    Joined:
    Feb 18, 2015
    Posts:
    26
    @pKallv Sorry, what do you mean by correct format?
     
  4. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    In the asset's import settings, is it set to a Texture or a Sprite or..?

    When the resource is selected does the Inspector show a preview?
     
  5. NoobieNoob

    NoobieNoob

    Joined:
    Feb 18, 2015
    Posts:
    26
    @angrypenguin I see. The image is imported as texture, I changed it to sprite and everything works well now. Thanks a lot.

    Another question please: Does resize the image to occupy the entire canvas and also set the Anchor points to the edges makes this image auto scale to fit the entire screen on different screen resolutions?
     
    Last edited: Apr 1, 2015
    angrypenguin likes this.
  6. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Here's a tip: When posting a new question make it a new post rather than an edit. People are more likely to notice it and/or get notifications if they've opted in.

    From the sentence structure I don't understand the question... but I do believe you can get stuff to scale to fit different resolutions.
     
  7. NoobieNoob

    NoobieNoob

    Joined:
    Feb 18, 2015
    Posts:
    26
    @angrypenguin Thanks.. I will remember the tip.
    I managed to put the image I want in the canvas but I want that image to fill the entire screen in game mode and to resize to fit no matter the screen resolution is.
    So if someone opened the game on a screen resolution 1280x800 he will see the image fits the entire screen, if another one with screen resolution 1920x1080 opened it I want the image to appear full screen too.
    How can I do that?
     
  8. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    You'll have to learn how to use the anchoring system. It'll take a bit of practice, but is well worth it. I suggest making some dummy objects and trying out different anchor settings while changing the game view's size to see how it all works.
     
  9. NoobieNoob

    NoobieNoob

    Joined:
    Feb 18, 2015
    Posts:
    26
    @@angrypenguin Do you have a link to a tutorial or it is trial and error thing?
     
  10. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    You can check out the Learn section. I learned it by using it, but documentation was limited at the time.
     
  11. GToma

    GToma

    Joined:
    Jul 23, 2014
    Posts:
    1