Quick answer: Unity Splines package showing CPU spikes after runtime spline edits? Length cache rebuilds on every Evaluate after edit - call ComputeCachedData once after edit batch.
Procedural road generator edits a spline per frame; Evaluate costs 4ms per call instead of microseconds.
Batch edits and rebuild once
spline.SetKnot(...);
... batch ...
spline.ComputeCachedData();One cache rebuild after the batch. Subsequent Evaluate calls are fast.
Or use a non-cached spline
For one-off lookups, SplineUtility.EvaluatePosition doesn't require cache. Skip the rebuild.
Profile with the Spline profiler
Splines package adds profiler markers. Spline.Evaluate shows per-call cost; spikes correlate with edits.
“Spline caches optimize for read-heavy. Write-heavy means working around the cache.”
If you regenerate splines often, consider mesh-baking instead. Splines for tooling; baked meshes for runtime.