Godot Version
4.6
Question
I have a main menu scene that I’ve set up where grab_focus can select multiple buttons with a controller and they work flawlessly. Then we get to my pause scene or game over scene and they practically don’t work at all with what I feel like is the same logic. I’m obviously missing something. Using my game over scene with two buttons, my scene is hidden until my players health reaches 0. The scene is unhidden and grab_focus is set to be called once that is done. The top button that is referenced is selected, but I cannot select the 2nd button like i can flawlessly in my main menu scene. I can hover over and select either button just fine with my mouse. Ive been stuck on something which seems pretty simple for days.
If this isn’t enough, I’ll post the entire scripts and inspector screenshots but what’s relevant now in my eyes is below:
Player script:
func hit(damage, dir):
$PlayerHitSound1.play()
hp -= damage
hp = max(0, hp)
health_bar.value = hp
currentvel += dir * PUSHBACK
if hp <= 0:
$GameOverLaugh.play()
game_over()
func game_over():
$GameOver.visible = true
get_tree().paused = true
$GameOver/ResetButton.grab_focus()
GameOver Script:
extends CanvasLayer
@onready var reset
button: Button = $ResetButton
func _ready() → void:
hide()
self.visibility_changed.connect(_on_visibility_changed)
func _on_visibility_changed():
if visible:
#$ResetButton.grab_focus() doesn’t work at all
$ResetButton.call_deferred(“grab_focus”)
func _process(_delta: float) → void:
pass
func _on_reset_button_pressed() → void:
GameOver.hide()
get_tree().paused = false
get_tree().reload_current_scene()

