GarbageCollector AnimationListener Node

Hi lets say i have a node with an animation channel and i attack an animation control to it
If i do node.detachFromParent , will it be collected by GarbageCollector
Or do i need to remove a listener from it as well ?
Is there any method to delete any possible listener , or do i need to finde the right one?

Once all references are gone it is garbage collected. So if there is no reference to the listener it will be garbage collected, too.

Thats not what iā€™m asking.
I have one listenere for 100 nodes(animated geoms)
lets say i take one node and detach from parent , do i need to detach listener as well or not ?
(to get node collected , not listener)
I dont even know ,if its a listnere that has animControl , or its a control that has listener .
And who calls who , its a control who calls listenere when needed , or is a listener who calls control to check each frame ?

Objects are garbage collected when no reference to it exists anymore.

If you have one listener and pass that listener to 100 objects - and one or more of those 100 object are no longer required (they are not referenced anywhere) - the object will be garbage collected.

1 Like