How do I make a custom button...

without the GUI class?

It appears that GUI renders the UI elements as 2D only and I cannot find a way to rotate or translate the GUI screen even though the camera that the GUI is attached to moves.

I guess I need one of two solutions if some one knows how.

A) Allow the unity GUI to be moved in 3D space or
B) Create a custom button with hover state

Thanks

I just tried attaching the GUI script to a plane in 3D space and it also just draws the buttons in 2D space. I understand why this happens… I just cannot figure out what to use to create a 3D button.

HitTest and every other function that would help me belongs to the GUI class. The only other idea that I can come up with is using a box collider but I don’t understand how to read whether the mouse is over it or not.

Any help would be great.
Thanks

It sounds like you’re using the GUITexture and GUIText objects, which are the old-fashioned way of doing GUIs. Rotating and such is actually not possible with these objects.
When using UnityGUI (That is, the functions in the GUI and GUILayout classes), you can use GUI.matrix - or, more simply, GUIUtility.Rotate/ScaleAroundPoint - to rotate and rescale your GUI items around.

Thank the UI Gods!!! I will look into this… thanks a lot.

Looks like RotateAroundPivot and Scale both use vector 2 not vector 3. So I still need a way to make a custom button.

Well, you could certainly use GUI.matrix to do what you need, the question is how to build a matrix that transforms points in the way you need. It’d be a fun project to make a button that can be stretched to nearly any arbitrary corner points - and it’d be very popular, no doubt. Unfortunately I’m not very familiar with Matrix4x4, but maybe someone else in the community who knows them better could help with creating such a matrix - a function that takes a Rect and 3 or 4 Vectors as parameters, and returns a matrix that transforms the Rect into one cornered by those vectors.

OnMouseOver, OnMouseExit, etc.

–Eric