TouchScreenButtons don't work when project exported to android
Asked Answered
N

28

0

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?

Narcose answered 8/1 at 21:23 Comment(0)
S
0

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.

Secularity answered 8/1 at 22:17 Comment(0)
N
0

Secularity Can you test it in godot 4.2.1? Because whatever I do they just don't work

Narcose answered 10/1 at 19:26 Comment(0)
N
0

tested this on two different projects - both don't work

Narcose answered 10/1 at 19:27 Comment(0)
S
0

Narcose 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.

Secularity answered 10/1 at 19:40 Comment(0)
N
0
buttonsdontwork.zip
6kB

both versions don't work

Narcose answered 10/1 at 20:7 Comment(0)
S
0

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.

Secularity answered 10/1 at 21:45 Comment(0)
N
0

So maybe it is because of gradle? Idk what to do really i have like 100 of theese touchscreenbuttons in my game.

Narcose answered 10/1 at 22:0 Comment(0)
S
0

Why can't you use normal buttons?

Secularity answered 10/1 at 22:4 Comment(0)
N
0

Secularity I would need to change every touchbutton in the game which would take a lot of time. Could this possibly a bug?

Narcose answered 10/1 at 22:20 Comment(0)
S
0

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".

Secularity answered 10/1 at 22:29 Comment(0)
N
0

Secularity 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

Narcose answered 11/1 at 9:17 Comment(0)
N
0

Secularity ok

Narcose answered 11/1 at 9:17 Comment(0)
N
0

Secularity Maybe it is an emulator problem?

Narcose answered 11/1 at 9:21 Comment(0)
N
0

Tested two different projects on 2 different versions of godot on 2 different emulators with different settings, nothing works. Slowly loosing my mind 🙂

Narcose answered 11/1 at 14:29 Comment(0)
S
0

You're having the problem when using an Android emulator? What about on an actual Android device?

Secularity answered 11/1 at 15:53 Comment(0)
N
0

Secularity hehe i dont have one

Narcose answered 11/1 at 16:11 Comment(0)
S
0

You should have said that earlier. Can you upload the .apk for that small test project?

Secularity answered 11/1 at 16:18 Comment(0)
N
0

Secularity ok, ill try

Narcose answered 11/1 at 16:40 Comment(0)
S
0

I installed test2.apk on my Android phone.

Both buttons work. If I touch the left button, "touchscreen button pressed" is displayed. If I touch the right button, "normal button pressed" is displayed.

Secularity answered 11/1 at 19:52 Comment(0)
N
0

Secularity huh? So why does it not work for me. Maybe I should install a new version of android studio but I doubt that is the cause. The funny thing is everything worked normally before…

Narcose answered 11/1 at 20:1 Comment(0)
S
0

I have Android Studio installed, and have used it for making Android apps using Kotlin and Dart/Flutter.

But I've never used it for emulating a Godot Android app. I'd like to do that, but haven't figured out how. If you can provide instructions on how to do that, I could try it and see if I can duplicate the problem you're having.

Secularity answered 11/1 at 20:9 Comment(0)
N
0

Secularity ok

Narcose answered 11/1 at 20:16 Comment(0)
N
0

Secularity

Narcose answered 11/1 at 20:54 Comment(0)
N
0

i was testing a litttle bit more and it turns out it doesn't detect any touch input, only mouse.

Narcose answered 12/1 at 15:21 Comment(0)
N
0

Please, can anyone help?

Narcose answered 15/1 at 20:15 Comment(0)
N
0

Secularity did you try it already? 🙁

Narcose answered 17/2 at 14:11 Comment(0)
S
0

The instructions you provided were too vague, and I haven't been motivated to spend the time figuring out the details.

It might not help solve your problem anyway.

Secularity answered 17/2 at 17:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.