Game Development Reference
In-Depth Information
// C# user:
void DoMyWindow (int windowID ) {
…
switch (_currentTool) {
case TAB.STATUS : //Status
…
break;
case TAB.INVENTORY : //Items
ItemWindow();
break;
}
…
}
7. Let's go back to Unity, we can click on
Play
to see the result. We will see only
NONE
in the inventory box and the
Show items information here
text in the
tooltip box. So, we need to create the item
GameObject
and add it our
MenuObject
by going to
GameObject
|
Create Empty
to create the empty
game object and name it
Golden Key
.
8. Next, click on the
Golden Key
object that we just created and add the
item
script to this object, then go to its
Inspector
view and set up the attributes as fol-
lows:
Item
(script)
Icon
keyIcon
Info
This golden key looks very old. Looks like, it was made by someone in the Ancient
Rome.
9. Next, drag the
Golden Key
object from the
Hierarchy
view to the
MenuInRPGGame/Resources/Prefab
folder in the
Project
view to create
a prefab of this item. Then, we will remove the
Golden Key
object from the
Hierarchy
view by right-clicking on the object and choosing
Delete
.
10. Lastly, click on the
MenuObject
item in the
Hierarchy
view to bring up its
In-
spector
view at the
Menu
(script); go to
Items
and add it as follows: