Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you delete last CP in spline
#1
Hi just a quick question

How do you delete the last control point in a spline
Ive tried

Code:
newspline.Delete (newspline.ControlPointsList[newspline.ControlPointCount ]);

I've also tried last visible control point and last visible segment.

I just keep getting out of range exception error.

Cheers
Reply
#2
newspline.ControlPointsList[newspline.ControlPointCount - 1]
Arrays in C# are zero indexed, meaning that first element index is 0, and last of is the length of the array - 1
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
doh schoolboy error on that one ( one day I'll stop making them ), thanks anyway.
Reply
#4
you are welcome
Bonus info: IEnumerable have extension methods called First() and Last()
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 1 1 Yesterday, 10:12 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 2 Yesterday, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
Thumbs Up Can't delete connection lacota 3 6 03-16-2024, 11:34 AM
Last Post: _Aka_

Forum Jump: