Game Development Reference
In-Depth Information
Classified Intel
In this step, we were using a GUI class to create our window, box, and buton, but we can
also use a GUILayout class to create the same thing as we did with GUI class. The only
difference between these two classes is that GUI will need to take a Rect object to specify
the size and posiion of the UI. On the other hand; GUILayout doesn't need to take the
Rect object. It will automaically adjust the size related to the source it has. Let's say, we
want to create a box that contains a text or image, GUILayout will automaically adjust
the height and width to nicely it your text or image. For the posiion, GUILayout will
automaically set the irst posiion to the top-let corner of the screen, which is (0, 0), and it
will coninue to the right or down depending on the GUILayout object that we already have
on the screen. However, the downside is that we will not be able to create a ixed posiion
or size for the GUILayout . So, both classes are very powerful to use. We can use them in
diferent situaions.
You can see more details of the GUI class at this UR L:
http://unity3d.com/support/documentation/ScriptReference/GUI.h tml .
You can also see the details of the GUILayout class at this UR L:
http://unity3d.com/support/documentation/ScriptReference/GUILayout.
ht ml .
The GUI.DragWindow() funcion allows us to create a draggable window by specifying the
drag area on our window. You can visit the following URL to see the detail s:
http://unity3d.com/support/documentation/ScriptReference/GUI.
DragWindow.h tml .
We will see this funcion take one Rect parameter, which is the area that allows the user
to drag the window around. However, we didn't assign Rect parameters to our GUI.
DragWindow() funcion, which means that we can drag the whole window area.
Creating a status tab
In this step, we will create a status page for our menu, which will show all atributes of
this character, including hit points, magic points, level, experience, experience needed for
the next level, atack, defense, agility, intelligence, and luck. We will also show the current
equipment and skill of this character.
 
Search WWH ::




Custom Search