Entity removed()


(Spencer Ericson) #1

Is add() and remove() the right way or is it create() and recycle().

I am asking because when I have console enabled, I can see my memory go up every time I add or remove an entity.


(Bora Kasap) #2

i think you can use

world.removeAll();

and then set the new world

world = new Level2();

oh did you edit your post? another question, hmm…

your memory goes up first, but flash gonna start clearing unneccessary store in memory. So, if you have no performance problem, don’t worry about that too much. But if you have “continuously” spawning entities, it’s better you use create() for them because of add + cleaning both makes more process on memory. When you use create + recycle, flash don’t need too much cleaning process in memory, so that means better performance.


(Spencer Ericson) #3

Thankyou, it worked :P. I have another question but accidentally edited my thread.


(Spencer Ericson) #4

Thankyou. I am a bit noob in programming.


(Bora Kasap) #5

Me too, don’t trust my answers too much :smiley: