Path-Creator
Path-Creator copied to clipboard
How do I clear a path? Possible bug?
I need to load points from a script. Firstly I want to clear my path. I tried to override all points via code:
var points = new Vector2[pathCreator.bezierPath.NumPoints];
for (var i = 0; i < pathCreator.bezierPath.NumPoints; i++) { points[i] = pathCreator.bezierPath.GetPoint(i); }
points[0] = Vector3.zero; // Some new value :)
var bezierPath = new BezierPath(points, false, PathSpace.xy);
pathCreator.bezierPath = bezierPath;
And I it doubled my Bezier points. If I run that code more times I have x4, x8 point count. I expect the same curve as it was before because with that code I don't change nothing. And the second question is how to clear bezier points before settin' new values? How to change a position of just one point of the Bezier path?