Does GodotSharp have a function to Quit from code?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SupToasty
:warning: Old Version Published before Godot 3 was released.

Is there a GodotSharp alternative to Engine.get_main_loop().quit()?

Why are you searching for an alternative? What’s wrong with this function?

Zylann | 2017-11-09 19:10

I can’t find the C# equivalent to exit the game. Is there an api reference online somewhere?

SupToasty | 2017-11-10 00:28

:bust_in_silhouette: Reply From: Zylann

Looking at this doc page: Handling quit requests — Godot Engine (latest) documentation in English

It seems Engine.get_main_loop().quit() doesn’t exist. Instead the function is in SceneTree, and you trigger it by doing get_tree().quit().

Note that in C# the name format is CamelCase instead of snake_case, but the API is the same for all languages (and specified as snake_case^^)

:bust_in_silhouette: Reply From: SupToasty

I found it! I was Originally calling Engine.GetMainLoop.(LIST OF METHODS) and GetTree.(LIST OF METHODS)but quit is under GetTree().Quit() Thanks Zylann.