I want to intercept keyboard inputs at higher-level nodes and prevent them from propagating downwards to other child nodes, if possible.
Originally, I was trying to do
get_tree().set_input_as_handled(), but input events were still happening in my child nodes.
My root node adds a scene - GameScene - in it's _ready function:
const game_scene = preload('res://scenes/game_states/game_state.tscn')
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")
var level_instance = level_1.instance()
In my stage01 scene, I have a Player scene that looks at input thru unhandledinput() function, and does something based on that input.
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 unhandledinput() function to mark every input it receives as handled.
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.