Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Rotating GUI.Box causes clipping

Discussion in 'Immediate Mode GUI (IMGUI)' started by gretty, May 13, 2013.

  1. gretty


    Jun 20, 2012

    I am attempting to rotate 2 different GUI Boxes's on the Z Axis. Each box will have a different Z axis value. The following image shows how I am trying to make them appear(I made the following image in photoshop):
    View attachment 53236

    My Problem: I am unable to rotate my boxes on the Z axis without clipping occurring. I can successfully rotate my panels on the x and y axis but not the Z without clipping occurring. Also can I have 2 boxes with a different z rotation using GUI.Matrix (I've read in other questions that this isn't possible)?

    This is what happens:
    View attachment 53236

    Any ideas how I can achieve the rotation that is shown in my first image?

    Code (csharp):
    1. void OnGUI() {
    2.         Matrix4x4 guiMatrixOrig = GUI.matrix;
    3.         GUI.matrix = Matrix4x4.TRS(, Quaternion.Euler(0, 45, 0), new Vector3(1.0f, 1.0f, 1.0f));
    4.         GUI.Box (new Rect (10,10,400, 400), "Loader Menu");
    5.         GUI.matrix = guiMatrixOrig;
    6.     }
    Last edited: May 15, 2013
  2. col000r


    Mar 27, 2008
    I've run into the same issue and found no way around it. It seems the clipping planes of the GUI-Camera are very close together. For something like this, I'm afraid you might have to use some other system (like NGUI) instead...
  3. dkozar


    Nov 30, 2009
    Unfortunately, you cannot rotate UnityGUI in 3D. You can rotate and resize it in 2D, so "skewing" is the maximum you can get. You cannot put it into the perspective.