TouchScreenButton not working

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

Hello!
I’m building a splash screen with a Sprite and a TouchScreenButton as the child. I connected the released() signal to the screen’s script, but when I press the button nothing happens. I debugged the call function using print, but looks like the function is not being fired. I’m using Godot 3.0 RC3. Is there anything I can do? Thank you.

EDIT: the Emulate Touchscreen is already enabled.

:bust_in_silhouette: Reply From: volzhs

TouchScreenButton is for touch
I assume you tested it on PC.

if you want to test it on PC,
set Emulate Touchscreen option is On at ProjectSettings > Display > Window

I forgot to say that I already enabled the touch screen simulation. My apologize.

Hyperbolic | 2018-01-30 19:57

There is no “Emulate Touchscreen” option in ProjectSettings > Display > Window, or anything even remotely similar to that. Where should I enable the setting?

Also, if I enable it, will it work in exports as well? That is, when the game is done, will exports for PC be able to interact with the touchscreen button?

mymokol | 2022-02-16 11:24

:bust_in_silhouette: Reply From: Hyperbolic

I found the solution!
I have a scene as singleton that handles the transition between scenes. It’s a CanvasLayer root node, so I couldn’t press the button because the layer were blocking the button. I fixed the problem changing its layer during transition and turning back to original layer when finished.

This is the code:

extends CanvasLayer

var path = ""

func goto_scene(scene_path):
	self.layer = 1
	path = scene_path
	$AnimationPlayer.play("change_scene")

func _change_scene():
	if path != "":
		self.layer = 0
		get_tree().change_scene(path)
:bust_in_silhouette: Reply From: isdev

I had to define a shape before pressed() signal started firing. Using 3.0.2 here.

:bust_in_silhouette: Reply From: hsojo91

From Godot v3.1 the location for emulating touch from mouse has changed:
Project > Project Settings > General > Input Devices > Pointing set Emulate Touch From Mouse to On