Cannot update individual points of Line2D in C#

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

Hello,

I have noticed an issue with Line2D when working in C#. I noticed that the points do not update properly when setting the Points array property on the Line2D class.

This does not work:

someLine2D.Points[0] = new Vector2(10, 10);
someLine2D.Points[1] = new Vector2(10, 15);

However ironically enough using the obsolete SetPoints function DOES work:

someLine2D.SetPoints(new Vector2[]{new Vector2(10, 10), new Vector2(10, 15)});

Manually setting the points also works as expected when in GD Script. The issue is only in C# when trying to manually set the points of the Line2D. When in C# the values do not change and stay at (0,0). What could be causing this, and is there a workaround besides what I am doing right now and having the code that controls the Line2D in GD Script for now. Something is not allowing the array to update. Thanks.

:bust_in_silhouette: Reply From: CybrNight

So after looking at this again with fresh eyes that weren’t suffering from sleep deprivation I have remembered that C# properties that handle arrays cannot be indexed like regular arrays. Setting the points array to a new Vector2 fixes the issue.