Assuming that this is “Test.js”
// Test.js - begin
class A
{
var a1 : int;
var a2 : float;
};
class Test extends MonoBehaviour
{
var objA : A;
function Awake ()
{
objA = new A ();
…
Destroy ( objA );
}
};
// Test.js - end
If I created a variable named objA…
and then use the keyword new to allocate the memory for it,
and then I want to remove it from the memory at the end of the Awake function…
Which function should I call to remove objA from the memory?
Or just set it to null?
( Actually Destroy function can only destroy objects of some classes
such as GameObject, Component, but I wrote it in the code snippet above
just to express my idea )