GUIUtils

What is it?
It's a GUI helper written in UnityScript ("UnityJS") for creating rectangles with size and position absolute/relative to any side of the screen.

This plugin was created for Unity 3.4 Compatible Unity 3.5

How to use GUIUtils ?
Mainly you just put a Vector4 in the function doing what you want (which point of the rectangle your working with) Vector4ToRect_XYWH where X = (L)eft/(C)enter/(R)ight et Y = (T)op/(M)iddle/(B)ottom.

The first two coordinates are the position of the point of the rectangle you want to place. If coordinates are positive, the position is calculated from Top/Left side of the screen, else the position is calculated from Bottom/Right side of the screen.

If coordinates/sizes have an absolute value higher than 1, then it is calculated with pixels, else it is calculated in Screen %.

For example, using Vector4ToRect_CM( Vector4( 0.5, -0.3, 1.0, 200 ) ) create a Rectange with its center at 50% of the screen from left side of the screen (horizontally centered), at 30% of the screen from bottom side of the screen, with a width of 100% of the screen and a height of 200 pixels.

Note : I used Vector4 so the variables are grouped together in the Inspector and you dont have to declare 4 different attributes.

Who do I contact for help / questions?
Feel free to email me if you upgrade/clean/adapt/translate this code.

[mailto:magniez.indiana@gmail.com Indiana MAGNIEZ]

The testing script
You can use this script adding it on an object in your scene after addition of GUIUtils.js to your project (ideally in Plugins).