Search Unity

3d GUI - based on width

Discussion in 'Immediate Mode GUI (IMGUI)' started by KEric, May 3, 2013.

  1. KEric

    KEric

    Joined:
    Jan 11, 2013
    Posts:
    62
    Hi,
    I'm trying to make a 3d GUI to my game and I would like to know if it's possible to have my gui perspective camera width equal to my device width. To be more specific - I know that different devices can have different screen aspect ratios. Because of that I want to position my ui elements based on the screen/camera width. I will leave some space at the top and the bottom so that they could be clipped away on some devices. Still I need to be sure that the visible width in the camera frustum will not be clipped automatically. Is it somehow possible to achieve?
     
  2. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    If you don't want to change the size of your GUI (i.e. "layout"), check out this post. It explains how to keep your GUI in the center of the screen.

    If you want to scale your GUI elements, you could use GUIUtility.ScaleAroundPivot on your top-most container.