Hi _Aka_,
Hope you're good.
So the full error message for the Index out of Range is as follows:
Code:
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <c040dc59dcbc4ddb95ffc99a02c8bae9>:0)
System.Collections.ObjectModel.ReadOnlyCollection`1[T].get_Item (System.Int32 index) (at <c040dc59dcbc4ddb95ffc99a02c8bae9>:0)
FluffyUnderware.Curvy.CurvySpline.DistanceToSegment (System.Single distance, System.Single& localDistance, System.Boolean& isOnSegmentStart, System.Boolean& isOnSegmentEnd, FluffyUnderware.Curvy.CurvyClamping clamping) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Splines/CurvySpline.cs:1768)
FluffyUnderware.Curvy.CurvySpline.DistanceToSegment (System.Single distance, System.Single& localDistance, FluffyUnderware.Curvy.CurvyClamping clamping) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Splines/CurvySpline.cs:1719)
FluffyUnderware.Curvy.CurvySpline.DistanceToTF (System.Single distance, FluffyUnderware.Curvy.CurvyClamping clamping) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Splines/CurvySpline.cs:1672)
FluffyUnderware.Curvy.Controllers.SplineController.AbsoluteToRelative (System.Single worldUnitDistance) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/SplineController.cs:573)
FluffyUnderware.Curvy.Controllers.CurvyController.get_RelativePosition () (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/CurvyController.cs:515)
FluffyUnderware.Curvy.Controllers.CurvyController.ComputeTargetPositionAndRotation (UnityEngine.Vector3& targetPosition, UnityEngine.Vector3& targetUp, UnityEngine.Vector3& targetForward) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/CurvyController.cs:894)
FluffyUnderware.Curvy.Controllers.SplineController.ComputeTargetPositionAndRotation (UnityEngine.Vector3& targetPosition, UnityEngine.Vector3& targetUp, UnityEngine.Vector3& targetForward) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/SplineController.cs:722)
FluffyUnderware.Curvy.Controllers.CurvyController.InitializedApplyDeltaTime (System.Single deltaTime) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/CurvyController.cs:860)
FluffyUnderware.Curvy.Controllers.SplineController.InitializedApplyDeltaTime (System.Single deltaTime) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/SplineController.cs:709)
FluffyUnderware.Curvy.Controllers.CurvyController.ApplyDeltaTime (System.Single deltaTime) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/CurvyController.cs:1410)
FluffyUnderware.Curvy.Controllers.CurvyController.Update () (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/CurvyController.cs:768)
And for the NullReferenceException is here:
Code:
NullReferenceException: Object reference not set to an instance of an object
FluffyUnderware.Curvy.Controllers.SplineController.HandleReachingNewControlPoint (FluffyUnderware.Curvy.CurvySplineSegment controlPoint, System.Single controlPointPosition, FluffyUnderware.Curvy.CurvyPositionMode positionMode, System.Single currentDelta, System.Boolean& cancelMovement, FluffyUnderware.Curvy.CurvySplineSegment& postEventsControlPoint, System.Boolean& postEventsIsControllerOnControlPoint, System.Single& postEventsControlPointPosition) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/SplineController.cs:1540)
FluffyUnderware.Curvy.Controllers.SplineController.EventAwareMove (System.Single distance) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/SplineController.cs:1130)
FluffyUnderware.Curvy.Controllers.SplineController.Advance (System.Single speed, System.Single deltaTime) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/SplineController.cs:653)
FluffyUnderware.Curvy.Controllers.CurvyController.InitializedApplyDeltaTime (System.Single deltaTime) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/CurvyController.cs:844)
FluffyUnderware.Curvy.Controllers.SplineController.InitializedApplyDeltaTime (System.Single deltaTime) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/SplineController.cs:709)
FluffyUnderware.Curvy.Controllers.CurvyController.ApplyDeltaTime (System.Single deltaTime) (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/CurvyController.cs:1410)
FluffyUnderware.Curvy.Controllers.CurvyController.Update () (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/Controllers/CurvyController.cs:768)
I'm using the spline in my own code, when the OnPositionResearchSetting is executed, I'm basically invoking a delegate on the object that animates the spline whereby it destroys the gameobject containing the CurvySpline components.
However, based on what you said about how it should work, I'm wondering if perhaps the problem could be with my code so I'm going to go back and rethink things.
Apologies, this could be totally my fault with not waiting for the animation CurvySplines to complete what it needs to do before deleting it.
Will let you know.