And sometimes (random actually), I get this error,
NullReferenceException: Object reference not set to an instance of an object
CurvySpline.MoveConnection (.CurvySpline& spline, System.Single& tf, System.Int32& direction, Single fDistance, CurvyClamping clamping, Int32 minMatchesNeeded, System.String[] tags) (at Assets/Curvy/Base/CurvySpline.cs:573)
cause con = CurvyConnection.GetBestMatchingConnection(cons, tags); returns null :
public Vector3 MoveConnection(ref CurvySpline spline, ref float tf, ref int direction, float fDistance, CurvyClamping clamping, int minMatchesNeeded, params string[] tags)
{
List<CurvyConnection> cons = GetConnectionsWithin(tf, direction, fDistance, minMatchesNeeded,true, tags);
if (cons.Count > 0) {
CurvyConnection con;
if (cons.Count == 1)
con = cons[0];
else
con = CurvyConnection.GetBestMatchingConnection(cons, tags);
CurvySplineSegment cp=con.GetFromSpline(this);
float cptf = SegmentToTF(cp);
fDistance-= cptf-tf;
CurvySplineSegment counterp=con.GetCounterpart(cp);
tf = counterp.LocalFToTF(0);
spline = counterp.Spline;
return spline.MoveConnection(ref spline, ref tf, ref direction, fDistance, clamping, minMatchesNeeded, tags);
}
else
return spline.Move(ref tf, ref direction, fDistance, clamping);
}
NullReferenceException: Object reference not set to an instance of an object
CurvySpline.MoveConnection (.CurvySpline& spline, System.Single& tf, System.Int32& direction, Single fDistance, CurvyClamping clamping, Int32 minMatchesNeeded, System.String[] tags) (at Assets/Curvy/Base/CurvySpline.cs:573)
cause con = CurvyConnection.GetBestMatchingConnection(cons, tags); returns null :
public Vector3 MoveConnection(ref CurvySpline spline, ref float tf, ref int direction, float fDistance, CurvyClamping clamping, int minMatchesNeeded, params string[] tags)
{
List<CurvyConnection> cons = GetConnectionsWithin(tf, direction, fDistance, minMatchesNeeded,true, tags);
if (cons.Count > 0) {
CurvyConnection con;
if (cons.Count == 1)
con = cons[0];
else
con = CurvyConnection.GetBestMatchingConnection(cons, tags);
CurvySplineSegment cp=con.GetFromSpline(this);
float cptf = SegmentToTF(cp);
fDistance-= cptf-tf;
CurvySplineSegment counterp=con.GetCounterpart(cp);
tf = counterp.LocalFToTF(0);
spline = counterp.Spline;
return spline.MoveConnection(ref spline, ref tf, ref direction, fDistance, clamping, minMatchesNeeded, tags);
}
else
return spline.Move(ref tf, ref direction, fDistance, clamping);
}