0 votes

Whenever I reload the current scene, my game gets a somewhat big lag spike. That wouldn't be too big a deal, except it's a pretty difficult game, so if there was a lag spike every time you reset the level it would get annoying quick. I'm not really sure how I would go about optimizing this, so any ideas are appreciated.

Update: I've found a way to "soft reset", as Lopy suggested. For a while I was stumped on how to do it, but it's actually pretty simple. Just make a group for the things that need to be reset, add functions to make them reset however you need, and then use get_tree().call_group(). Really simple, actually. I just forgot groups existed for a while, haha

Godot version 3.2.3
in Engine by (98 points)
edited by

2 Answers

+1 vote
Best answer

You could make a "soft" reload. Instead of reloading everything, you just replace the things that need to. Spikes regrow on ceilings, clouds teleport back to the starting lines, etc.
It can be difficult to make everything resetable, especially if you didn't account for it and you are quite far in development, but it might be necessary if reloading everything from scratch is too slow.

Also, remember that Godot comes with a profiler. You can use it see what function take the most time

by (2,276 points)
selected by
0 votes

you can make a colorrect which change visiblity.I use this too in my games. I dont know if you know what I mean. Her is a tutorial https://www.youtube.com/watch?v=_4_DVbZwmYc

by (254 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.