SceneManager seems to be calling the"init(t)" for the scene every time the scene is changed to, is this normal or have I got something wrong somewhere?
The demo on github does this too.
If it should do this then what is the point of the "onTransitionInBegin()"?
Also does this mean that assets that are created in the scene are are re-created - what about memory leaks?
Should I release any bitmaps, etc loaded with the init stage? If so, when?
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
https://deluxepixel.com
Comments
Well not really recreated, while object is destroyed, it's still in memory for sometime (until it's garbage collected) and I think that if next scene uses same object, which is already in memory, then it will be reused (but @atilim can correct me if I'm wrong.)
I think that onTransitionInBegin is more for a consistency
And if bitmaps etc are children of the scene, no you don't have to release them, they will be released themselves.
You can check this thread for more info
http://www.giderosmobile.com/forum/discussion/1423/class-inheritance-and-memory#Item_5
And it also would be nice if @atilim confirmed the info in that thread to be completely correct or not
Likes: SinisterSoft
And if the textures and sounds are still in memory (not GCed yet), they will be reused when the new scene is created.
(The EnterFrame seems to carry on for the scene whilst the scene is not displayed).
https://deluxepixel.com
Likes: SinisterSoft
(I think the SceneManager itself needs more docs to show what happens and that you should really get rid of the ENTER_FRAME listener as the event is exited, it would also help if the init was documented to show that it is called each time the scene is started rather than just once, the 'onTransitionInBegin' being basically redundant).
https://deluxepixel.com