+1 vote

Godot 3.1 BETA 1

Hello again,

So I have the root default viewport, but I have created another viewport inside that which I use for scaling the game area.

My issue is getting TextureButtons inside the sub viewport to handle input. If I move the buttons into the viewport container, they work ok. As soon as they become a child of the viewport... they stop working.

My project structure is this:

Node
   |---TextureRect
   |---ViewportContainer
      |--- Viewport
          |--- CanvasLayer
             |--- HBoxContainer
                |--- TextureButton

I have the mouse filter on the ViewportContainer and HBoxContainer set to "ignore". On the sub viewport itself "Disable Input" is NOT set to "On", and I'm running out of ideas to try :)

Any thoughts would be appreciated, thanks!

in Engine by (366 points)

Can you share some code? perhaps you should reconnect signal after moving to new viewport.. have you don that?

The signals are hooked up in the editor. If I drag the CanvasLayer out of the Viewport, it works. The script is attached to the HBoxContainer and only has this code in it:

extends HBoxContainer

func _on_btn_test_pressed():
    print("Pressed")

It's like the Viewport is blocking input somehow, I just can't figure out why.

Just to clarify, once you move the button into the viewport, have you tried disconnecting and reconnecting the signal? From the editor

I have tried reconnecting the signal, but it doesn't help unfortunately.

Can you share the project?

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.