Search Unity

Background Image + Main Camera + Canvas

Discussion in '2D' started by Flybye, Apr 25, 2015.

  1. Flybye

    Flybye

    Joined:
    Mar 25, 2015
    Posts:
    100
    Hi all,

    I'm trying to wrap my head around these 3 things. Why is it that the background image can be sized to fit perfectly in the camera, but the camera is only a tiny little fraction of the canvas, yet the camera is capturing both the same sized background and everything in the canvas?
     
  2. Deleted User

    Deleted User

    Guest

    Because the canvas is rendered in a different way, is not the camera rendering it. If you want the camera to render the canvas, go to your canvas component and change from Screenspace Overlay to Screenspace Camera, then select the camera you want to use for the canvas and you will see the whole canvas resize to the size of the camera.
     
  3. Flybye

    Flybye

    Joined:
    Mar 25, 2015
    Posts:
    100
    Ok thx!

    So which way is more efficient? Having the camera or overlay? Are there any pros/cons to either?
     
  4. Deleted User

    Deleted User

    Guest

    Well the overlay is more precise on the distribution of pixels, as it uses unity units for each pixel (especially if you use pixel perfect canvas), so if you don't plan to move the canvas within the camera for some bobbing effect there is no need to go Camera.

    FOr Screenspace camera the only thing I can think of beign an advantage if is you want to make it have some kind of movement behaviour, think of Crysis 2 bobbing hud when you run or walk orm aking it go trough objects as the canvas is physically in the world instead of beign well... an overlay..

    So in the end if you don't need to do anything fancy in the canvas and just show images and text, stay with overlay as you won't need to care much of the canvas when modifying it.