Hello there.
It’s useful to have an option to pass visual elements between scenes (e.g. loading screen). Examples:
- Loading screen should have nice and shiny disappear animation revealing game content
- Loaded scene may need to perform some final preparations that could be asynchronous (e.g. fetch avatars)
- etc.
There is cc.game.addPersistRootNode
that seems suitable. At first glance. But then there’s a problem: loading screen needs canvas
to adapt to different screen sizes and only root node could be persisted (i.e. canvas
in that case) but main scene also has canvas
to adapt it’s content to the screen and therefore I get an error about multiple active canvases.
How that should be handled?
My ideas are:
- Adapt loading screen by custom code instead of canvas
- Have
canvas
disabled by default on main scene and reattach loading screen content from onecanvas
to another inloadScene
-s callback and then destroy previous one and activate new one (though I didn’t test that. Maybe error message is misleading and you cannot have multiplecanvas
-es no matter what state they are in). But that would be cumbersome to always maintain that inactive state for main scenecanvas
when editin.