0 votes

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)'.

Godot version 3.1.1-stable
in Engine by (134 points)

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?

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.

1 Answer

0 votes

did u try set_process_input(true) in ready function?

by (72 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.