Godot Version
4.4.1 Mac OS
Question
func _on_quit_pressed() → void:
get_tree().quit(
This line works fine for quit button on Mac when testing it inside Godot , but after exporting to iOS it doesn’t turn off game and it continue operates .
Also I’m able to start game after pressing it , but many functionalities of game won’t work , but player input from touch still response .
Some tips how to solve this ?
Mobile devices work different these days, and they don’t generally expect the user to “close” an application in the normal sense. There’s a section about this in the documentation:
1 Like
You can’t quit on iOS. Apple doesn’t allow it. They won’t approve an app that can quit.
2 Likes
What can I do then to avoid the bug ?
Hide the close button on iOS
2 Likes
Cool , how can I do this ?
$button.hide()
Specifically:
match OS.get_name():
"iOS": $Button.hide()
2 Likes
I have tried , but this unfortunately break whole control it showing on iOS whole pause menu,
Here is script I used
extends Control
func _ready() -> void:
var quit_btn = null
if has_node("Quit"):
quit_btn = $PanelContainer/VBoxContainer/Quit
match OS.get_name():
"iOS" : quit_btn.hide()
$AnimationPlayer.play("RESET")
mouse_filter = Control.MOUSE_FILTER_IGNORE
visible = false # Hide pause menu at start
func resume():
get_tree().paused = false
mouse_filter = Control.MOUSE_FILTER_IGNORE
visible = false
$AnimationPlayer.play_backwards("blur")
func pause():
get_tree().paused = true
mouse_filter = Control.MOUSE_FILTER_STOP
visible = true
$AnimationPlayer.play("blur")
func testEsc():
if Input.is_action_just_pressed("esc"):
if get_tree().paused:
resume()
else:
pause()
func _on_restart_pressed() -> void:
resume()
get_tree().reload_current_scene()
func _on_resume_pressed() -> void:
resume()
func _on_quit_pressed() -> void:
get_tree().quit()
func _process(delta: float) -> void:
testEsc()
func _on_button_pressed() -> void:
if get_tree().paused:
resume()
else:
pause()
OS.get_name() is not as reliable, I’d recommend using feature tags.
Introduction: Godot has a special system to tag availability of features. Each feature is represented as a string, which can refer to many of the following: Platform name., Platform architecture (6...
So in your case, you could use:
OS.has_feature("ios")
Note that this is case sensitive, so it MUST be all lowercase, as the documentation shows.
1 Like
var quit_btn
func _ready() -> void:
quit_btn = $PanelContainer/VBoxContainer/Quit
if OS.has_feature("ios"):
quit_btn.hide()
this worked , thank you
1 Like
system
Closed
September 24, 2025, 10:49pm
11
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.