needle-mirror / com.unity.splines

Work with curves and paths. Use the Splines package to generate objects and behaviors along paths, create trajectories, and draw shapes. 📦 [Mirrored from UPM, not affiliated with Unity Technologies.]
https://docs.unity3d.com/Packages/com.unity.splines@2.7/manual/index.html
Other
18 stars 12 forks source link

Cannot clear SplineContainer.Splines #3

Open aholkner opened 1 month ago

aholkner commented 1 month ago

The following code does not work as expected

var splineContainer = GetComponent<SplineContainer>(); // Assume this container already has some splines
splineContainer.Splines = null; // Should clear all existing splines
splineContainer.AddSpline(new Spline()); // Expect to have one spline now

The reason is that SplineContainer.set_Splines sets m_Splines to Array.Empty, but does not clear m_ReadOnlySplines, which SplineUtility.AddSpline depends on.

marwie commented 1 month ago

Please report issues to unity directly.

This is just an inofficial package mirror so you can fork and fix code while still being able to upgrade