Godot Version
4.6
Question
So once again I am here with a problem I ran into after upgrading to 4.6. This code was working in 4.5, but in another game that I’m working on in 4.6 it stopped working.
This code is supposed to update the size of the collision area in editor, but it doesn’t. Here it is:
@export_category("Collision Area")
@export var side : SIDE = SIDE.LEFT :
set(value):
side = value
update_area()
@export_range(1, 12, 1, "or_greater") var size : int = 2 :
set(value):
size = value
update_area()
func update_area() -> void:
var new_rect : Vector2 = Vector2(40, 40)
var new_position : Vector2 = Vector2.ZERO
if side == SIDE.TOP:
new_rect.x *= size
new_position.y -= 20
elif side == SIDE.BOTTOM:
new_rect.x *= size
new_position.y += 20
elif side == SIDE.LEFT:
new_rect.y *= size
new_position.x -= 20
elif side == SIDE.RIGHT:
new_rect.y *= size
new_position.x += 20
if collision_shape:
collision_shape.shape.size = new_rect
collision_shape.position = new_position
What could be the reason for this not working anymore?