New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't directly modify points of Line2D #62857
Comments
Why simply not use |
Oh I didn't see these methods 🤔 |
This probably happens due to the weirdness of Packed Array passing behavior. Since #62462, the VM doesn't unnecessarily set values back to parent when something was modified in-place (shared stuff like Array, Dictionary, etc.). However, Packed Arrays are edge cases. They are currently shared types within the boundaries of GDScript (they are assigned to vars by reference, and they pass to GDScript functions just like Arrays do), but they are copied when passing between GDScript and the C++ API. See #36492 (comment). The optimization in #62462 regards Packed Arrays as shared types (which they kinda are), however |
So, we were discussing this in the GDScript meeting, and one potential solution would be to update the In any case, we need to update |
This is also partly broken for 3.x already:
This however works at least:
So there is probably more. |
Still present in v4.0.beta.custom_build [91713ce]. Can't edit a CSGPolygon3D's polygon directly (PackedVector2Array): csgpolygon3d_ref.polygon.set(1, Vector2(1.0, 1.0)) # Doesn't change the value
print(csgpolygon3d_ref.polygon[1])
csgpolygon3d_ref.polygon[1] = Vector2(1.0, 1.0) # Doesn't change the value
print(csgpolygon3d_ref.polygon[1]) The same workaround of setting a new PackedVector2Array works. |
Godot version
d26442e
System information
Windows 10 x64
Issue description
Broken:
Also broken:
Workaround:
I remember it was fine a month ago or so.
Probably not related to Line2D, but this where I noticed this first.
Steps to reproduce
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: