My root node adds a scene - GameScene - in it's _ready function:

const game_scene = preload('res://scenes/game_states/game_state.tscn')
func _ready():
    var game_scene_instance = game_scene.instance()

And my GameScene, it adds my Level1 scene in it's _ready() function:

const level_1 = preload("res://scenes/stages/stage01.tscn")
func _ready():
    var level_instance = level_1.instance()

In my stage01 scene, I have a Player scene that looks at input thru _unhandled_input() function, and does something based on that input.

func _unhandled_input(event):
    if event.is_action_pressed('ui_down'):
        print("Adding 15 points to the player's score")

But, I do not want my Player scene to receive any input. So, in my GameScene, I implemented it's _unhandled_input() function to mark every input it receives as handled.

func _unhandled_input(event):

But, if I press the 'ui_down' key on my keyboard, I still see "Adding 15 points to the player's score" printed in the console. Because I set the input as handled in the grandparent node, I thought that it wouldn't propagate downward?


1 Answer 1


After looking some more into how Godot handles input(and events in general), I found that instead of events propagating from the root downward, they propagate upwards from the rightmost node of the rightmost branch.

Since events are handled in the order of _input, _input_event, and then _unhandled_input, I just changed _unhandled_input in my GameScene to _input.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .