![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | sygi |
I’d like to have a dummy Viewport around a scene to make it easier to substitute when changing scenes:
> root
>> ViewportContainer
>>> Viewport
>>>> myScene: Node2D
>> UI: Control
I have a problem when passing the input to myScene
: I set the ViewportContainer
to pass input, and in the Viewport I tried:
onready var child: Node2D = get_node("myScene")
func _input(event):
child._input(event)
The _input
function is called, but I’m getting the error: Nonexistent function '_input' in base 'Node2D (myScene.gd)'
.
do you have a function called _input(event): in your myScene.gd node?
do you add your myScene by code after the viewport is initialized or are they already set inside a prefab?
Surtarso | 2021-03-27 18:25
I don’t, _input
I thought it’s implemented by default. However, when I do, I’ll have to propagate the input manually. Is there a way to automatically pass all the inputs down the tree? When I used the hierarchy:
> root
>> myScene: Node2D
>> UI: Control
the input passing is handled automatically.
sygi | 2021-03-27 19:45