1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

GDScript: Call setter on simple setter chain without getter

Fixes a bug where a member variable was being set directly before
calling the setter.
This commit is contained in:
George Marques
2024-07-09 12:45:07 -03:00
parent 82cedc83c9
commit 87c90a573c
3 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
# https://github.com/godotengine/godot/issues/85952
var vec: Vector2 = Vector2.ZERO:
set(new_vec):
prints("setting vec from", vec, "to", new_vec)
if new_vec == Vector2(1, 1):
vec = new_vec
func test():
vec.x = 2
vec.y = 2
prints("vec is", vec)

View File

@@ -0,0 +1,4 @@
GDTEST_OK
setting vec from (0, 0) to (2, 0)
setting vec from (0, 0) to (0, 2)
vec is (0, 0)