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
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_
  GO can't fit end of the spline GameDeveloperek4123 3 13 03-04-2024, 11:06 AM
Last Post: _Aka_
  Keeping a fixed spline length jh092 3 16 02-21-2024, 06:25 AM
Last Post: Primrose44

Forum Jump: