|Attention||Topic was automatically imported from the old Question2Answer platform.|
I have a singleton named Globals set up in my game. Below is a screenshot of the project settings:
The main scene for my game is Game.tscn and I have the following code in that scene:
func _ready(): if get_viewport().size.x > tile_size.x * Globals.GridSize.x: zoom_factor = (tile_size.x * Globals.GridSize.x) / get_viewport().size.x min_zoom = zoom_factor if get_viewport().size.y > (tile_size.y * Globals.GridSize.y) / zoom_factor: zoom_factor = (tile_size.y * Globals.GridSize.y) / get_viewport().size.y min_zoom = zoom_factor
The game is working fine when I run it on my PC. Yesterday it was working fine on Android via both USB and package install, however today I’m getting the following error when running on Android:
Invalid get index ‘GridSize’ (on base: ‘Nil’) (Line 19)
Line 19 is:
zoom_factor = (tile_size.x * Globals.GridSize.x) / get_viewport().size.x
From the debugger I can see that Globals is [null], whereas when I run the game on my computer it shows me the object ID of Globals. It looks like the singleton is no longer recognised on Android.
Does anyone have any idea what might have caused this and how I can fix it?
I have tried removing and readding the singleton with no success. I don’t really know what else to try…today I haven’t modified anything in project settings or Game.tscn, so I can’t work out why this is impacted.
Does your apk contain “assets/Globals.gdc” and “assets/Globals.gd.remap”?
(You you should be able to check the apk contents with any unzip tool.)
Check the build log of the apk (output window) if any file access errors or signing errors occur when building the apk.
wombatstampede | 2019-04-18 11:19
Yes, I can see both those files in the apk.
There are no errors in the output box, and looking at the command prompt window which is open while Godot is running, there’s only a warning at the end to say the jar contains entries whose certificate chain is invalid. I don’t think this is related, but including a screenshot here in case.
derekjwhitten | 2019-04-22 00:46