This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi, I am wondering how I would restart the entire game. I know you can reload a current scene, but I need everything to restart, as if the game has just been started. Do you know how to do this? Thanks

Godot version 3.4
in Engine by (599 points)

1 Answer

0 votes

Maybe create a second project that instances the first project using OS.execute()?

var pid = OS.execute(OS.get_executable_path(), [], false)

https://docs.godotengine.org/en/stable/classes/class_os.html#class-os-method-execute

And, when you want to restart, you'd just OS.kill() the first project's PID and then call OS.execute() again.

https://docs.godotengine.org/en/stable/classes/class_os.html?rtd_search=autoload#class-os-method-kill

There's probably a better way, because this is actually instancing two projects running at once, but that's what I could come up with.

by (214 points)
edited by
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 Frequently asked questions and 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 [email protected] with your username.