GUIBuilder

Author: Shaun Lelacheur-Sales (shaunls)

Description
The following scripts can be added to GUITextures/Texts to automate some of the simple Win/OSX common UI controls. There are 2 main scripts used for different functions:

1. GenericGUIMethods - Use this script for panels, buttons, checkboxes etc.

2. GenericTextFieldMethods - Use this script for getting text input.

Usage
Setting up GenericGUIMethods.cs

1. Create your GUI hierarchy (look at the first screenshot for an example) - the top object should ideally be a 'Panel' type.

2. Add the script to all non-static GUITextures in the hierarchy and set the following options:

VisibleOnAwake = Can we see this object when the player starts?

DontDestroyOnSceneLoad = Will be kept between scene changes - be careful as it could be loaded twice.

ButtonDisabledColor = the color of a button (or any object) when its its state is set to disabled.

ButtonEnabled = is the button (object) enabled or not (i.e can receive input)

TextureMouseSelected = Texture of selected state

TextureMouseOver = Texture of over state

TextureMouseNormal = Texture of normal state

ContextHelpText = The GUITexture that is used for popup help (on mouse over)

TopLevelParent = The uppermost parent in the hierarchy (should be the container panel)

LinkToGUITextGameObject = The GUIText object that this GUITexture is linked to (used for textbox graphics that sit behind a GUIText)

ObjectGlow = makes the object slowly glow (alternating glowing icons in a progress panel are a neat use for this option)

ButtonSelected = Is the button currently selected (generally used for checkboxes and radiobuttons)

Frozen = The frozen state is used to lock and fade a whole hierarcy (i use it for freezing the login panel when processing a login request)

TextFieldTabCount = Number of text fields in form hierarchy (COMING SOON)

TextFieldTabActive = Currently active tab (COMING SOON)

Setting up GenericTextFieldMethods.cs

1. In your form(panel) hierarchy you probably have some GUITextures that represent textboxes. You will need GUITexts to actually read the keyboard input from your user, so this script is used to 'link' the textbox GUITexture and GUIText together so that they will appear to operate as one.

2. Make the GUIText object a child to your textbox GUITexture (you can check the 2nd screenshot to see how its done)

3. Add the script to the GUIText and set the following options:

TopLevelParent = The uppermost parent in the hierarchy (should be the container panel)

TabID = This textfields TabID (COMING SOON)

MaximumWithInPixels = the maximum width in pixels that the text field can extend to

strDefaultText = the default text in the textfield

IsPasswordField = is this a normal text entry field, or password style (masked characters)

PasswordMaskingCharacter = if a password field, this character will be used to mask input (i generally just use "*"

IsLabel = Labels cannot receive input - set to false if you want to 'capture' typing

strRealText = This is the 'real' text contained in the textfield (not the displayed text) - generally can just be blank.

Good luck!

Example Screenshots


Above: Setting the options for a Radio button using the GenericGUIMethods Script.



Above: Setting the options for a password field using the GenericTextFieldMethods Script.