How to get size of TileMap (as Vector2) when onready and _ready() are called?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By System_Error

Hi all.

I was wondering… Is there a way to get the cell size of a TileMap as a Vector2 when it enters a scene? I’m asking because not all maps are the same size, and I’d like to get their bounds for navigation.

:bust_in_silhouette: Reply From: njamster
extends TileMap

func _ready():

Hm. Odd.

error: The method "size()" isn't declared on base "Rect2()".

System_Error | 2020-03-20 03:31

Sorry, my bad, it’s a property, not a method. So it’s get_used_rect().size, without the brackets in the end. I’ll edit my answer accordingly.

njamster | 2020-03-20 12:30

Ah, thank you.

System_Error | 2020-03-20 12:54