Godot version: c8700f83a1832a6c9b809af17ce67f5f0ba2ef32
OS/device including version: Android 6.0
Issue description:
Examine the following gdscript:
for i in range(5) :
print(i)
One would expect to log the numbers 0-4 in console. While this works on Windows, on Android I get the following:
11-07 13:37:15.736 9633 9646 I godot : 2
11-07 13:37:15.736 9633 9646 I godot : 0
11-07 13:37:15.736 9633 9646 I godot : 0
11-07 13:37:15.736 9633 9646 I godot : 0
11-07 13:37:15.736 9633 9646 I godot : 5
11-07 13:37:15.736 9633 9646 I godot : 0
11-07 13:37:15.736 9633 9646 I godot : 0
11-07 13:37:15.736 9633 9646 I godot : 0
Which is very strange and incorrect.
Steps to reproduce:
Use range() in a for loop
Minimal reproduction project:
New Game Project.zip
Try something like this maybe, I still have not seen the code yet but this might help.
def frange(start, stop, step):
i = start
while i < stop:
yield i
i += step
for i in frange(0, 4):
print(i)
I can work around the issue just fine using Vector2(0, 5) instead of range(5). I feel like it would be better to fix gdscript.
Is this still reproducible in the current master branch or latest beta build?
Tested with 8889089c1b on a Samsung Galaxy S3, can't reproduce the bug.
It was either fixed in the meantime, or maybe you were actually using Android templates that don't match your editor version (I can see you had custom templates in your export preset).
Most helpful comment
I can work around the issue just fine using
Vector2(0, 5)instead ofrange(5). I feel like it would be better to fix gdscript.