Does touch input event has "up" and "down" callbacks as mouse event?

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

I have created a touch input script for custom button class. Which is basically just extended Godot.Button class. I’m running this script in Android. I have disabled “Emulate mouse from touch” due to some mechanic problem where touch and mouse events were being called together. Because of that, I’m not receiving any “button_down/up/pressed” signal for touches. To work around that I had to write this script.

using Godot;


public class TouchButton : Button {

private protected Timer tapTimer = new Timer();
private protected const float TAP_TIME_THRESHOLD = 0.2f;
private protected InputEventScreenTouch onlyTouch = null;

public override void _Ready() {
	tapTimer.OneShot = true;
	AddChild(tapTimer);
}

public virtual void OnButtonPressed(){}

public virtual void OnButtonDown(){}
public virtual void OnButtonUp(){}

public override void _GuiInput(InputEvent @event) {
	if (@event is InputEventScreenTouch touch) {
		if (touch.Pressed) {
			if (touch.Index == 0) {
				GD.Print("Button down");
				OnButtonDown();
				onlyTouch = touch;
				if (tapTimer.IsStopped()) {
					tapTimer.Start(TAP_TIME_THRESHOLD);
				}
			} else {
				onlyTouch = null;
			}
		} else {
			if (!tapTimer.IsStopped()) {
				tapTimer.Stop();
				GD.Print("Button pressed");
				OnButtonPressed();
			}
			GD.Print("Button up");
			OnButtonUp();
		}
	}
}

}

In above script, I’m only receiving “Button down” output in terminal. No “pressed” or “up”. Is it default behavior for touch inputs or am I doing something wrong?

Thanks!

[Edit]

Here’s Button that I’m working with:

using Godot;
using System;

public class Exit : TouchButton {
public override void _Ready() {
	base._Ready();
	if (OS.GetName() == "iOS") {
		this.Hide();
		return;
	}
	this.Connect("pressed", this, "OnExitPressed");
}

private protected void OnExitPressed() {
	GetTree().Quit();
}

public override void OnButtonPressed() {
	OnExitPressed();
}
}
:bust_in_silhouette: Reply From: decepticlown

It is currently a bug in Godot. Control _gui_input inconsistent behavior with InputEventScreenTouch · Issue #29525 · godotengine/godot · GitHub