Hello!
I have a pretty basic script that’s trying to make use of the expand() method:
var new_rect: Rect2i = Rect2i() # Rect should be initiated with a size of 0,0
new_rect.expand(Vector2i(15,15)) # Exanding rect to 15,15
print("Map rect: ", new_rect.size) # Is printing 0,0 for some reason
Am I missing something, or should the print line be outputting 15,15?
Obviously I’m attempting to use this in a more complex setting, but even this basic test script doesn’t work for me.
Any clue why the expand() function isn’t working as expected?
Thanks!
extends Node2D
var rect: Rect2i = Rect2i() # Rect should be initiated with a size of 0,0
func _ready() -> void:
var new_rect = rect.expand(Vector2i(15,15)) # Exanding rect to 15,15
print("Map rect: ", new_rect.size) # print the size of the rect copy