Hi there,
I’m trying to push a custom class to an array and then output the value - but I’m having trouble. I can push the class object to the array without error, but when when I try to print ‘EventMeta.EventObject.score’ I get a NullRef. Code sample below, can anyone help?
private var CurrentTime : int = -1;
private var EventMeta = new Array();
class EventObject extends System.ValueType {
internal var type : String;
internal var time : int;
internal var score : int;
internal var height : int;
}
function PushToArray() {
var c = new EventObject();
CurrentTime++;
c.type = "Story";
c.time = CurrentTime;
c.score = Random.Range(0,1000000);
c.height = Random.Range(100,300);
EventMeta.push(c);
print(EventMeta.EventObject.score);
}