Normal buttons work just fine but for some reason touchscreenbuttons don't work at all when exported. They workk normally when on my computer. I checked - no control nodes blocking the buttons. Any idea how to fix?
TouchScreenButtons don't work when project exported to android
- Edited
I just added a TouchScreenButton to an existing project and tested it with an Android export from Godot 4.3-dev1. It worked correctly.
To test it, I added a child Label to it and attached this script, which increments a displayed count on each button press:
extends TouchScreenButton
func _ready() -> void:
$Label.text = "0"
pressed.connect(func(): $Label.text = str(int($Label.text) + 1))
I generally use normal buttons, which for Android require enabling the project setting input_devices/pointing/emulate_mouse_from_touch, but that's not needed for a TouchScreenButton.
DaveTheCoder Can you test it in godot 4.2.1? Because whatever I do they just don't work
- Edited
tested this on two different projects - both don't work
- Edited
belgian_street_lamp Can you test it in godot 4.2.1?
I've deleted the test code. But you can create a minimal project to test it in 4.3-dev1. I doubt if there's been a change in that area.
By "minimal project", I mean a project that contains nothing but the button, label and script.
If it fails in both 4.2.1 and 4.3-dev1, upload the minimal project.
both versions don't work
I downloaded the .zip, imported it into Godot 4.3-dev1, and exported it to Android using one-click install. The TouchScreenButton works.
The only change I made was to disable "Use Gradle Build" in the Project / Export settings. I had to do that so that I can use the standard export templates.
So maybe it is because of gradle? Idk what to do really i have like 100 of theese touchscreenbuttons in my game.
Why can't you use normal buttons?
DaveTheCoder I would need to change every touchbutton in the game which would take a lot of time. Could this possibly a bug?
- Edited
If it's a bug, why does the button work for me?
Did you try disabling "Use Gradle Build"?
Try searching the github issues. I found several by searching for "TouchScreenButton".
- Edited
DaveTheCoder Maybe it only doesnt work when you use gradle. From my understanding i need to use gradle because of my plugins or something.
edit: it also doesn't work without grade. I have know idea what im doing wrong T-T
DaveTheCoder Maybe it is an emulator problem?
- Edited
Tested two different projects on 2 different versions of godot on 2 different emulators with different settings, nothing works. Slowly loosing my mind
You're having the problem when using an Android emulator? What about on an actual Android device?
DaveTheCoder hehe i dont have one
You should have said that earlier. Can you upload the .apk for that small test project?
DaveTheCoder ok, ill try