I have a class:
class aPart
{
var partName : String;
var partDescription : String;
var partIcon : Texture2D;
var partIconRect : Rect;
}
public var partList = new Array();
During runtime, i need to make a new part and add it to an array of parts i have:
function storeNewPart(partToStore : String)
{
var newPart : aPart;
newPart.partName = partToStore; //null reference here, why?
newPart.partIcon = Resources.Load(partToStore);
partList.Add(newPart);
ArrangeParts();
}
I am an artist turned scripter, and have been stumped by this for several hours now. I can not find any good solution around this. What is the correct way to create a new part on the fly and add it to my partList?? Thank you for taking a look ![]()