Why is there a difference between the engine and Android?

Godot Version

Godot4.7 beta2

Question

I’m developing a board game, and the pieces move smoothly between squares using the engine. The physics engine is good, and I like that.

However, when exporting it to Android, this movement changes. When a piece moves from one square to another, it disappears from its original position and appears outside the board in the next square.

Does anyone know why this happens and how to fix it?


Impossible to tell without seeing your code and node structure.

Hi! Mustapha share some insights

@tibaverus @yahyasaid935

"Thank you for your response!

I’m using a CanvasLayer (layer=100) to animate a TextureRect moving from one grid cell to another. The animation works perfectly in the Godot editor, but on Android the piece disappears from its position and appears flying in from outside the screen.

Here’s the relevant code:

var src_center = src_btn.global_position + src_btn.size / 2

var dst_center = dst_btn.global_position + dst_btn.size / 2

var mover = TextureRect.new()

mover.position = src_center - mover.size / 2

get_tree().root.add_child(mover)

tween.tween_property(mover, “position”, dst_center - mover.size / 2, 0.22)

My project settings:

Godot 4.7 beta2

Display stretch mode: [canvas_items]

The game is portrait mode for Android

I suspect it’s related to viewport scaling — the global_position values seem different between editor and Android."

The Windows and Android versions do indeed behave differently when exporting. I assume this is due to differences between the operating systems themselves and how they function. I suspect you’ll need to fine-tune the project manually.

You can compare them — I used exactly the same code here, but in the Android version, you can see the lighting on the clothing when it changes, whereas in the Windows version, that layer is invisible.

Godot 4.7 Stable