Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem adding control point after another control point via script
#6
Ok, I had a look. The problem is related to Unity's loading and initialization order. You didn't take that into account, so you've added the CP before the Spline initializes itself.

In general, before working with a spline from another script, do:

Code:
IEnumerator Start () {
spline = splineObject.GetComponent<CurvySpline>();

while (!spline.IsInitialized)
yield return 0; // this waits until the spline is ready

// Do whatever you want...
}
You don't need to wait for it in Start(), but then be sure to check CurvySpline.IsInitialized before working with the spline. See the docs here .

Cheers
Jake
Reply


Messages In This Thread

Possibly Related Threads…
Thread Author Replies Views Last Post
  Control Point Interpolation Overrides. rickgplus 1 522 12-11-2025, 08:52 AM
Last Post: _Aka_
  12_Train junction point richardzzzarnold 5 3,404 04-16-2025, 02:19 PM
Last Post: _Aka_
  OnAfterControlPointAdded - Control Point is null jh092 5 3,165 02-04-2025, 09:31 PM
Last Post: _Aka_
Photo Volume Spots problem with spacing Bond007 3 2,538 01-20-2025, 12:27 PM
Last Post: _Aka_

Forum Jump: