grab_focus not allowing normal button selection

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()

Bro you can see your formatting is all broken, right?

Are you sure it’s grab_focus that doesn’t work, and is not that everything is frozen after the get_tree().paused = true ?

New user. It was late I just added everything and posted quickly before bed and didn’t notice.

mode for the canvas layer in the inspector is set to always with the buttons set to inherited so it wouldn’t be that, right?

Figured it out. I had no vboxcontainer on my game over scene so the selection obviously couldn’t work correctly

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.