Code: Select all
ForEach ZoneActors(class'PCPillarJr',PP)
{
if (PP != none)
{
PP.Destroy();
PP = None;
}
}
Code: Select all
ForEach ZoneActors(class'PCPillarJr',PP)
{
if (PP != none)
{
PP.Destroy();
PP = None;
}
}
As far as I am aware there isn't an opposite of "new" in UScript, exactly over the fact that UScript has its own garbage collector and thus generally languages with garbage collectors do not have operators to explicitly deallocate objects from memory.sektor2111 wrote: I recall some question about opposite of "new". I'm not only not using "new", because I'm not creating classes, I load classes created, but for sure opposite of "New" should be something like "Self = None" in that class or some outsider controller.
Code: Select all
//create a new object
A = new class'SomeObject';
//"destroy" object (it only really disappears once it gets garbage collected internally)
A = None;
Code: Select all
//create a new object
A = new class'SomeObject';
//copy reference to B
B = A;
//unassign from A, but it's not garbage collected as B is still referencing it
A = None;
Code: Select all
if ( Something == None || Something.bDeleteMe )
TreatAsNone();
Unless I misunderstood what you meant, not doing the bDeleteMe check is not bad coding in itself. The engine is the one which is badly designed in that sense, since you as a developer should never have to do more than 1 single check for what is essentially the same end condition.Higor wrote: If code or whatever other mod's never evaluates for actor's bDeleteMe var after the NONE check, then yes dereference to workaround bad coding.
Code: Select all
if ( Something == none )
Etc();