I am using Resources.Load to pull a texture image from the project and then taking values from that and creating a new GUIContent variable from them. But when I try to push or add them into a GUIContent[ ] it tells me that Add nor Push are part of (UnityEngine.GUIContent); I can add them into an array just fine but I can’t then feed the array into a Selection Grid since it is not a GUIContent[ ];
Any advice on how to do this?
function GUIContentFill(vendorCatalog : String, vendorID : int){
var vendorList = new Array();
var vendorInventory = new Array();
vendorList = vendorCatalog.Split(char.Parse("#"));
for(var i = 0; i < vendorList.length; i++){
vendorInventory = vendorList[i].Split(char.Parse("|"));
var endPos = (vendorInventory[0].Length - stringStartPos);
var itemName : String = vendorInventory[i].Substring(stringStartPos, endPos);
var itemTex : Texture2D;
itemTex = Resources.Load("EndlessVoidCatalog/" + vendorInventory[0]);
var itemTool : String = itemName;
var newGUIContent : GUIContent = new GUIContent(itemName, itemTex, itemTool);
storeInventory.Add(newGUIContent); //Array()
// storeGUIContents.Add(newGUIContent); //GUIContent[]
}
}
I’m wanting to use a SelectionGrid because you can only buy one thing at a time through a “Buy Now” button. I’m open to other ideas however.