How do i quit the app with ui?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GasStation

I need to quit the app because i will be hiding the cursor. How do i assign it with a UI_ function? The code i have now, doesn’t work, but has no errors, please help!

the code:

if Input.is_action_pressed("ui_end"):
    get_tree().quit()

the ui will change, but for now it is the “end” button.

:bust_in_silhouette: Reply From: jgodfrey

That looks correct to me (other than you didn’t format the code for the forum). Do you have the ui_end action appropriately wired? Maybe add a print statement in that function to make sure you’re getting there.

As an example, here’s a working exit function wired to a button…

func _on_BtnExit_pressed():
	get_tree().quit()

Thank You! It ended up working, great help on two lines of code.

GasStation | 2021-02-10 01:07