- Home /
Question by
FVortex · Oct 25, 2020 at 05:54 PM ·
c#collider2dpolygon collider 2d
Why can I not directly set the points of PolygonCollider2D?
I found out that this:
collider.points[0] = new Vector2(x, y);
will not change the point's position, whereas this does:
var points = collider.points;
points[0] = new Vector2(x,y);
collider.points = points;
I cannot understand why the first solution doesn't work: arrays are reference types after all, so why is it not working?
Thanks in advance for any help.
Comment
Your answer
Follow this Question
Related Questions
What is the equivalent of PolygonCollider2D.points for CompositeCollider2D? 0 Answers
How to edit PolygonCollider2D vertices IN CODE? 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
how to prevent an gameobject of instantiating if theres an collider where it is supposed to collide 1 Answer