The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

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;

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");
                onlyTouch = touch;
                if (tapTimer.IsStopped()) {
            } else {
                onlyTouch = null;
        } else {
            if (!tapTimer.IsStopped()) {
                GD.Print("Button pressed");
            GD.Print("Button up");


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?



Here's Button that I'm working with:

using Godot;
using System;

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

private protected void OnExitPressed() {

public override void OnButtonPressed() {
Godot version 3.3.3.stable.mono
in Engine by (153 points)
edited by

1 Answer

0 votes
Best answer

It is currently a bug in Godot.

by (153 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.