Everytime I press escape it takes me here and im very confused I think it has something to do with my grab focus

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

extends Control

func ready():
$MarginContainer/CenterContainer/VBoxContainer/TextureButton01.grabfocus()

func physicsprocess(delta):
if $MarginContainer/CenterContainer/VBoxContainer/TextureButton01.ishovered() == true:
$MarginContainer/CenterContainer/VBoxContainer/TextureButton01.grabfocus()
if $MarginContainer/CenterContainer/VBoxContainer/TextureButton02.ishovered() == true:
$MarginContainer/CenterContainer/VBoxContainer/TextureButton02.grab_focus()
if $MarginContainer/CenterContainer/VBoxContainer/TextureButton03.ishovered() == true:
$MarginContainer/CenterContainer/VBoxContainer/TextureButton03.grab_focus()

func _input(event):
if event.is_action_pressed(“ui_cancel”):
$MarginContainer/CenterContainer/VBoxContainer/TextureButton01.grabfocus()
get_tree().paused = not get_tree().pause
visible = not visible

func _on_TextureButton01_pressed():
get_tree().paused = not get_tree().paused
visible = not visible

func _on_TextureButton02_pressed():
get_tree().paused = not get_tree().paused

get_tree().change_scene("res://Scenes/TittleScreen.tscn")

func _on_TextureButton03_pressed():
get_tree().quit()

:bust_in_silhouette: Reply From: exuin

What is the error message exactly?

Anyway I think this is the error:

 get_tree().paused = not get_tree().pause

You forgot the d at the end.

thx im shoked I didn’t notice that d and sorry just realised I didnt explain it well it keeps telling me that it can’t get the null instance grabfocus() from the func input(event) function and idk why

MM2025 | 2021-06-25 17:15

That must mean MarginContainer/CenterContainer/VBoxContainer/TextureButton01 is not the correct path to your node.

exuin | 2021-06-25 17:28

true thx ill keep working on it

MM2025 | 2021-06-25 17:32