I see dead objects

Hi there again…



So I’m making this game. And I’ve made a level such that if you don’t finish it within the required time. It restarts. Now to restart, I basically remove everything there is attached to the rootNode and remove everything from the Phsyics Space. Then call the same function I used to initially setup the level. Hence, everything is loaded again.



However, every time I restart, the stats show that there are 4 Objects more than the last time. If I restart again, there are 4 more. And it keeps on increasing when eventually my fps starts dropping.



What could possibly be it? Is there a way to check which models have been loaded in the game at a current instance? Or a way to simply delete everything, so I can start over?

Somewhere you’ve forgotten to remove something, I guess. You could write a routine to dump all of the objects (and their children) in the root node or you could just look in the debugger. Either way, something in the root node, gui node, etc. has not been removed.

I had a similar problem and it turned out it were the nodes holding particle emitters which were not properly removed.

does your object count in the debug text go up? also you need to remove each physics control you add manually. [java]physicsSpace().removeAll(rootNode) [/java] won’t do as you think (thats if you use it)