How to get TextureButton to emit "pressed" signal inside sub viewport?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By i_love_godot

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:

      |--- 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 :slight_smile:

Any thoughts would be appreciated, thanks!

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

p7f | 2019-01-16 22:16

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():

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

i_love_godot | 2019-01-16 22:54

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

p7f | 2019-01-16 23:59

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

i_love_godot | 2019-01-17 00:09

Can you share the project?

p7f | 2019-01-17 00:20