-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CC 3.5.1 - Scene Swap Performance is slow #11503
Comments
Adding this issue here as well. I have no idea how to get to the sceneAsset without loading and applying the scene.
|
Also swapping scene in the background (having current scene set as persistent node just to be able to do a fast swap) requires tons of performance. Animations start stuttering when This is on a very powerful desktop machine. When throttling CPU 4x in chrome it almost freeze for a moment. What happens in the scene swap that makes it so heavy? |
Could you provide the project to us? We try investigating the performance hotspots and give you the feedbacks. |
@Zhmz I could make a demo, but just by dyanmically swapping scene with Also when when you put your current scene as persistent and load the next scene behind the current one, you get a huge lagg spike when it instantiates, so that's no good either. I tried this using CC 3.6.0
Even though you have preloaded the scene the swap is so slow with director.loadScene(). Using director.runScene() and director.runSceneImmediate() it requires sceneAsset or Scene (name is not accepted) so need to somehow get the sceneAssets to test the performance with it as well. How can I get the sceneAsset, when preloadScene is not returning it? Once you have launched a scene once and you make sure to not have the "auto release assets" checked |
The |
Could use |
Thanks, I'll give this a try again with the new CC 3.7.2! |
Hey @Ronsku ,did you find a solution to this, I am facing similar issues while switching screens? |
Hi, unfortunately the only solution is to go back to the old Cocos Creator 2 version. Even through Cocos Creator 3 is better in every other way, Cocos Creator 2 smashes when it comes to initialization, instantiation and bundle size. When Cocos Creator 3 has a matching or better engine startup time, prefab/scene instantiation time and bundle size, then it's time to move to Cocos Creator 3 and no reason I see to stay in Cocos Creator 2. Until then we're stuck in the old version, if you need quick startup, efficient instantiation and as small bundle size as possible to get the players loaded into the games asap. I think Cocos team is working on this, but it's probably not easy since they have 3D support in Cocos Creator 3. I just would like to be able to have a separation between 2D and 3D games, if 3D game rendering causes everything to become slower. This ticket was created over a year ago, I just have my fingers crossed. I don't want to be stuck in "legacy" projects for too long. I'm happy though to see updates now and then for Cocos Creator 2 as well 😊 |
am using Cocos 3.7.3 and facing Same Issue even after the preloading of Scene director.load() taking time to Switch Scene although the its taking time in first time.hoping issue will resolve quickly.. |
Thank you as well for testing, reporting and updating this ticket @SamridhChicmic! @holycanvas and @Zhmz, do you have any more thoughts on this and the delay of opening a already preloaded scene. Could the preloaded scene be somehow preLaunched or read into memory, so that we could instantly swap it when needed? |
Same issue here on the current latest version 3.8.3 |
Use Case
Related to this ticket: #10935
I use multiple scenes per game to keep everything organized. Just as an example, let's say you are playing a 2D overview game and walk into a door, you run a quick animation that opens the door (covering the whole screen with something) and swap scene mid animation where screen is covered by the animation. This animation could be ran on a persistent node above both scenes. This would make it possible to create a smooth transition from one scene to another.
Problem Description
Now, depending on the device you are running on the next scenes instantiation could take 100ms or 1000ms you cannot run it mid animation, instead you have to separate the animation into something
Run a "open animation" that covers the screen
Wait for scene swap (100ms 1000ms or how long it takes)
Then run a "close animation" to remove the overlay that covers the screen to reveal the new scene.
Sometimes I've used fade to black 500ms animation, then stay at black until scene has swapped and fade back to from the black overlay in the new scene. Problem here is that I want the swap to be fast and smooth, 500ms fade to black, 500ms fade back to invisible overlay. But since it might take a long time to instantiate the next scene player might be stuck in a black screen for a few seconds wondering "what is going on..?"
Proposed Solution
This is why it would be amazing to just be able to "await preLaunch()" a scene that does all the heavy lifting and basically instantiates the scene for you in memory and when you then "launchScene()" it would be instant. The same way you would just toggle "node.active = true". And my workaround with placing a scene as persistent node solves this in an ugly way.
How it works
No response
Alternatives Considered
Make sure preloadScene() not only downloads the assets but also prepares the scene to be launched within a few milliseconds.
Additional Information
No response
The text was updated successfully, but these errors were encountered: