|
I have an inventory script that creates an a button at the bottom of the screen for the items in the inventory, but I am encountering an issue as it currently simply has text, where as I want a different image in each box. I have linked the script below to show my issue: pragma strictvar obj_wood : GameObject; var obj_claw : GameObject; var obj_bread : GameObject; var obj_water : GameObject; var numberOfItems : Number; public var items = new System.Collections.Generic.Dictionary.<String,GameObject>(); private var curItem : System.Collections.Generic.KeyValuePair.<String, GameObject>; public var buttonHeight = 50; public var width = 100; AddItemToInventory(obj_wood); AddItemToInventory(obj_claw); AddItemToInventory(obj_bread); AddItemToInventory(obj_water); function AddItemToInventory (item : GameObject) { } function OnGUI() { var curIndex = 0; for(var item : System.Collections.Generic.KeyValuePair.<String, GameObject> in items) { //i have called each texture icon_"item name", but the texture variable wont accept a string } function RemoveItem (item : System.Collections.Generic.KeyValuePair.<String, GameObject>) { } function RemoveItem (item : GameObject) { } if you have any idea of how too this it would be appreciated thank you
(comments are locked)
|
|
thanks found the solution through GUI skins
Apr 11 '12 at 01:25 PM
chris gough
(comments are locked)
|
