0 votes

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.

Godot version Godot v3.2.3 mono
in Engine by (21 points)
edited by

1 Answer

+1 vote
Best answer

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()
by (10,884 points)
selected by

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

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.