Search Unity

GUI camera help

Discussion in 'iOS and tvOS' started by robhuhn, Jul 25, 2010.

  1. robhuhn

    robhuhn

    Joined:
    Jun 21, 2009
    Posts:
    113
    I set up a gui cam system which scales a plane used as gui element to the original screen size depending on the texture. My camera is not orthographic.

    Now I have massive performance issues. If i turn on that system the framerate drops to 2fps.

    I read another way to get the original texture size on screen is the set the camera to orthographic and its orthographic size to Screen.height.

    Thread

    Now if I set the orthographic size to 320 and scale the object to 50,1,50 (texture is 50x50) it has not the correct size.

    I dont get it :wink: Could anybody explain that to me?
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    An orthographic camera has no perspective and so it essentially just views a long parallel box from the scene. The top and bottom edges of the box will map directly to the top and bottom of the scene, but the width will depend on the screen's aspect ratio. The easiest way to get the height right is to set the camera looking along one of the main axes (this will be the Z axis if you set the rotation to <0,0,0>). If you then click on the same axis in the view widget, the camera view will be collapsed to a square in the scene view. Just scale your object to the appropriate height within that square and the height will proportional in the game view.