How to delete new'd arrays in JavaScript? -
i'm using unity, technically unityscript assume built-in arrays work same way. have array create thusly:
var room:roominfo[,,]; room=new roominfo[5,5,5];
what's deleting syntax? doing delete room;
or delete room[,,];
doesn't seem work. after deleting need this:
room=new roominfo[10,10,10];
seems ridiculously simple question confused these things , forget, , couldn't find on google (because couldn't work out search).
you don't need it, unityscript (automatic memory management). if still prefer own way do, use this:
room = null;
and after this, can initialise to:
room = new roominfo[10,10,10];
so full code be:
room = null; room = new roominfo[10,10,10];
Comments
Post a Comment