| Attention | Topic was automatically imported from the old Question2Answer platform. | |
| Asked By | holgerm |
I am very new to Godot (but I am experienced in other engines). I wanted to give Godot a go as the script is very similar to Python.
I thought, I would start with something very simply but in the end had big issues on performance on android only. Thats why I wanted to test something very simple to exclude my mistakes.
I rebuild this here as a test.
and modified the code a bit as I had some errors in Godot 3.1.2
Here is my modified code
extends Node2D
onready var grid_size = Vector2(get_viewport_rect().size.x, get_viewport_rect().size.y)
var cell_size = 64
var coord = Vector2(0, 0)
var global_x
var global_y
func _ready(): set_process_input(true)
func _input(event):
if event is InputEventMouseMotion:
global_x = event.global_position[0]
global_y = event.global_position[1]
var pos = Vector2(int(global_x/cell_size), int(global_y/cell_size))
if pos != coord:
coord = pos
print(coord)
get_node("coord").clear()
get_node("coord").push_color(Color(1, 1, 0))
get_node("coord").push_underline()
get_node("coord").add_text(str(coord))
get_node("coord").pop()
func _draw():
for x in range(0, grid_size.x, cell_size):
for y in range(0, grid_size.y, cell_size):
draw_line(Vector2(x, y), Vector2(x, y + cell_size), Color(0, 1, 0), 1.0)
draw_line(Vector2(x, y), Vector2(x + cell_size, y), Color(0, 1, 0), 1.0)
It works flowlesly on pc but on Android its extremly laggy.
Tested on a Samsung Galaxy S8
So why is this?
Its just a simple Node2D + the text label
Can you show in a video how laggy it is on Android ? Or show FPS values ?
Also did u try on other android phones ? just to make sure it is not a specific phone issue.
GameVisitor | 2020-01-05 20:44