Play button not working on Android - Godot

Everything is working fine when I run it on my computer but when I Remote Debug to the phone the TitlePlay button does not work. The small Debug button we created in the bottom left will work when tapped, but not the play button. I tried to mess with the order in the scene tree and z index but neither worked. I have “Emulate Mouse From Touch” enabled. I think it’s an issue recognizing the touch input but idk.

not totally sure. not got to that stage yet. unless theres something on the screen thats masking the mouse input and blocking it.

Ya I tried to hide the Debug screen to see if it was blocking input, but it didn’t help. It even works on the touch screen of the laptop I use, which makes me think It’s something on the phone side messing up but not sure what it could be.

any chance you could zip your project folder up and pop it online so i can have a look please?

ill get the phone out and see if i can help at all.

can always upload here and ill grab it. (Darren M on list)

< GameDev.tv Support Upload Page>

I got it submitted! Thanks for looking at it. Even the shop button I just added isn’t working, but the debug one does.

1 Like

ill get a look as soon as i sort SDKs etc out

did have a look at it, but nothings standing out to me. theres probably something im not seeing, but ive asked for further advice on things to check.

This might be helpful; seems a good checklist to me.

The button works when testing on PC just fine, but not on my Android phone.

Ah, missed that. Did you code the button’s functionality in _physics_process() by any chance? If you did, try switching it over to process().

Hi Mildwin,

The only thing i can think of is that its the device size or positioning of the button thats causing an issue.
It COULD be that its being blocked by something as i remember something about being a possible issue?

Unfortunately i cant test at the moment as my computer is being a real pain about recognising the phone i was using to test before but if i get it working i will try to take a look and see if can figure something out. This being said if it is a device issue it may be an idea to try a different device if you can to see if anything works there.

Keep me posted on any progress or or nothing changes if you do try another device.

So I put the project on to the phone and used the Godot mobile app to test it there. When I used “Run Game” the game ran perfectly and the button worked. I did not export it to test it on the phone this time. Which makes me think something is getting messed up in the export, unless the mobile app runs things differently, but I am not sure. It seems the Godot app is on 4.2.1 so not sure if that effects anything. Also, I am using a Samsung Galaxy 22 Ultra.

Might be worth posting your export settings as not entirely certain they come across in a project file or if you have changed them since the upload.

If you can post us screenshots i can check them against my project although mostly i think i used the run game as well.

I was using an older phone (S7) but my current phone is an S22 Ultra its just playing about wanting to connect to the pc (Probably my cable doesnt support data or something)

I will keep trying at my end

Here are the settings, let me know if I missed something.

Yeah those settings are fine.
I got my daughters old S7 back and working in godot this morning and tested it with my project and all the buttons work when i use the remote debug.
I opened your project in 4.1.2 and i get the same issue as you do.
I cannot for the life of me find where the issue is that its not detecting the button presses in your project and why it does in mine.

I can’t rule out 4.2.1 being an issue however and opening the project in 4.1.2 does not correct the issue.

At this point i suggest downloading the project from the resources and using 4.1.2 to open it and set up the remote debugging and see if it works there.
This way we can rule out a device and export issue and it is something to do with the project.

Let me know how you get on as i am scratching my head on this one.

So I was using 4.1.3 on my computer and did remote debug with my S22 ultra, and S9+ neither had working buttons. Then I used 4.2 on the computer and set up the Android export, tried remote debug neither phone worked. I used the phone mobile app of godot to test, and it worked there, so I’m not sure. Should I try 4.1.2 or a newer version? Did I possibly set up the buttons different from your project? Or is the input getting detected elsewhere?

Edit: I just made a small project with a single button and label. I update the text when I press the button and it works fine. Even when I Remote Debug the button works on my S22Ultra I exported on 4.1.3. So I must have messed something up with my project but have no clue what it could be.

Honestly i dont know at this point as its got to be a check box or something that we are missing.
Its just really strange it works in the editor but not in the phone.
I’ve checked everything i can think of and nobody i ask can think of anything it might be other than something blocking the input on the phone as it all seems to be set up correctly.
I’ve even done a side by side check of having both your project and my project on each monitor and i still cant find the issue.

I’ll keep digging in my spare time to see if i can pin down this issue if just for sanity’s sake!

Ya it’s all good. I even tried and downloaded the completed project got everything set up. Then the buttons worked on the phone. I didn’t get the Google stuff working yet but I’ll be trying that later on. Thanks for looking into it and all the help.

1 Like

One possible workaround for this issue is to ensure that your play button is properly configured to handle touch input. Verify you’ve correctly configured the touch event handlers for the play button and that they’re active when debugging remotely on the phone

  • it’s also worth checking to see if there are any conflicts with other elements of your interface or code that might block the play button from working when debugging remotely

im really sorry since its been a while, but i took my phone to work with my and decided this wasnt going to beat me. and have you lose out on progressing with the course.

think ive found what the issue was.

as a quick note, (and its something i initially didnt do, when i got your project), in the editor if we select
the debug > deploy with remote debug.
image

this will then show any errors in the godot editor output that are raised on the android device.

so i did this and, its not that your buttons etc arent working, its the soundFX that are being called that are causing the buttons to error out.

you can see from the error log here when running your project with the one click deploy on my samsung.

so starting off, it would appear that alot of the errors are stemming from the soundFX player.
looking at the first line.


from there i just spotted that its looking for
res://Scripts/sound_fx.gd

but as you can see from the scene tree, the scripts folder is all in lower case.

this does remind me of another issue i had found a while ago, where if a folder is renamed, say from ‘Scripts’ to ‘scripts’. godot will still hold a cache reference to the script with the old filename.

i double checked that by looking at the soundFX scene itself.
and sure enough, its still trying to use the folder with the capital S.
image

resolution:

in the sound_fx.tscn were in, on the root SoundFX node, you can either select it, then right click and detatch node, or click the red remove script button.
image

then, Scene Menu > save all the scenes. (just as an extra, that might clear away the connections).

then, right click that root node again, attach the sound_fx script thats in the ‘scripts’ folder.


then save the scene and close all the open scene tabs.

you will proably see now that your open scripts panel has two items for the sound_fx script.
just right click any one of those scripts and select ‘Close All’.

you might be lucky and get to run it at this point, but i think theres still alot of the editor cache messed up a bit.

so, close the project.
browse to where your projects saved.

with the project closed, delete the 'godot folder.

this folder will be rebuilt once you open the project again.

getting there, honest :slight_smile:

now, open your project again, and you should just be down to one warning.

this one is more straight forward.
if you click on it, it will take you to your game script.
this section here,
image

its saying its shadowing a variable, because were declaring a new variable here called ‘scale’ but, even though this variable is local to this function its in and will be deleted afterward, it overrides the inherited scale property of Node2D.

no biggie, just rename scale here to something else like.
image

that will get rid of all the errors.

Now, if you connect up your phone, it should work as intended.

you will have to reenable the Debug > Remote debug, just so you can see it all coming from phone.

i did find it strange that the errors didnt flag up with running in the editor, only when running remotely, with the debug option selected. otherwise, it was failing silently and just threw me on a red herring search the wrong way.

again, apologies for taking so long to figure it out, but thought i would write it all down as the remote debug is soooo handy and the duplicate folder thing has reared its head in the past.

Darren

2 Likes

Privacy & Terms