Edge collider points do not change

Why ?

They do not change, there are different points. :S

(Unity 2020.1)

You cannot assign to array elements like this because those points are actually value types (Vector2). When you access the .points[ ] array, Unity is making a copy for you, which you are the modifying and dropping. It is not actually assigning it anywhere useful.

Instead, copy out the points, change the ones you want, and put the entire points array back.

var points = ec2d.points;  // make a copy

points[0] = ...
points[1] = ...

ec2d.points = points;  // put it back

Almost all value type arrays (and a lot of reference type arrays such as .materials) work this way in Unity3D.

1 Like

Thank you , solved.

1 Like