Godot Version
Godot 4.3
Question
I am a student working on a project, for which I want to make some custom buttons. I currently have an area 2d with a sprite2d and a collision polygon 2d. I have linked it to a script with
func _on_char_custom_button_input_event(viewport: Node, event: InputEvent, shape_idx: int) → void:
print(“button clicked”)
if event.is_pressed():
get_tree().change_scene_to_packed(load(“res://scenes/character_creation.tscn”))
Yes I understand that I should preload the scene when I load the game, but it kept breaking when I did that and I haven’t gotten around to troubleshooting yet. My problem is the function isn’t working, but only when I fully run the game, it works in the debug run. The signal is connected, pickable is set to true on the area2d and it does have a collision layer. when I asked my teacher he said that this is how he always makes custom buttons and we couldn’t figure out why it was breaking. I want the buttons to be a custom shape so I can’t use a normal button node. Any workaround or alternate way to do this would be appreciated