Assigning an item to an existing array in a list within a dictionary [on hold]
- by Rouke
I have a Dictionary declared like:
public var PoolDict : Dictionary.<String, List.<GameObject[]> >;
I made a function to add items to the list and array
function Add(key:String, obj:GameObject)
{
if(!PoolDict.ContainsKey(key))
{
PoolDict[key] = new List.<GameObject[]>();
}
//PlaceHolder - Not what will be in final version
PoolDict[key].Add(null);
//Attempts - Errors- How to add to existing array?
PoolDict[key].Add(obj);
PoolDict[key][0].Add(obj);
}
I'd like to replace the line after //PlaceHolder with code that will assign a gameObject to an existing array in a list that's associated with a key. How could this be done?