Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IndexOutOfRangeException in CurvySplineSegment.LocalFToDistance function
#1
Question 
Im instantiating gameobjs with curvycontrollers to travel along a spline continuously; new objs spawn every 10 seconds or so and existing ones are destroyed once they reach the end of the spline for +3 seconds. When i run this game for 30min plus+, I sometimes get an IndexOutOfRangeException on line 1397 which is function FluffyUnderware.Curvy.CurvySplineSegment.LocalFToDistance in file CurvySplineSegment.cs. Not all gameobjs travelling along the same spline get this error, only maybe 1% do get this error. However, this error doesnt seem to affect anything, at least in my short term testing. The obj still travels fine along the spline and my colliders on it still work. 

I am not sure how ignoring this error in the long run will affect my program so ideally would like to get this error fixed. Thanks in advance! 

please let me know if i need to supply any more information.

EDIT: when the error occurs, the gameobj actually stops moving on the spline.
Reply
#2
Hi
What version of Curvy are you using?
If you reproduce the issue again, please send me the full callstack
Is the spline the used by the controllers modified at runtime?
Can you share the project or preferably a simplified version of it (no need for all the assets)? Keep in mind this is a public forum, so prefer sending me a link or the file via other means (PM, email)
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
(03-10-2021, 09:21 AM)_Aka_ Wrote: Hi
What version of Curvy are you using?
If you reproduce the issue again, please send me the full callstack
Is the spline the used by the controllers modified at runtime?
Can you share the project or preferably a simplified version of it (no need for all the assets)? Keep in mind this is a public forum, so prefer sending me a link or the file via other means (PM, email)

Hi Aka,

thanks for getting to me so quickly. My curvy version is 7.1.2. I have ran my game for about 2 hours now and the error still hasn't popped up yet. When it does again ill send you the full callstack. The spline is not modified at runtime. However, there are 4 splines in the scenes, and the error only seem to pop up on gameobjs spawned on one specific spline. I have checked the spline settings and they seem to be all the same. The entire project is pretty complicated, if we really can't figure it out ill try to get a simple version to you with the error. But for now, wait for my callstack. 

Thanks again!
Reply
#4
You are welcome

Please insert the following code just above the line 1397 that produces the exception, that will help understand what is happening once the exception happens again.
Code:
            if(idx >= ApproximationDistances.Length)
                Debug.LogError($"idx: {idx} ; length {ApproximationDistances.Length} ; length 2 {Approximation.Length}");
            else if (idx + 1 >= ApproximationDistances.Length)
                Debug.LogError($"idx  + 1: {idx + 1}  length {ApproximationDistances.Length} ; length 2 {Approximation.Length}");
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
(03-10-2021, 11:55 AM)_Aka_ Wrote: You are welcome

Please insert the following code just above the line 1397 that produces the exception, that will help understand what is happening once the exception happens again.
Code:
            if(idx >= ApproximationDistances.Length)
                Debug.LogError($"idx: {idx} ; length {ApproximationDistances.Length} ; length 2 {Approximation.Length}");
            else if (idx + 1 >= ApproximationDistances.Length)
                Debug.LogError($"idx  + 1: {idx + 1}  length {ApproximationDistances.Length} ; length 2 {Approximation.Length}");

hi aka,

thanks, i managed to get the error again, but this is before you replied me, so i haven't added this snippet yet. But here is the full call stack:

Code:
IndexOutOfRangeException: Index was outside the bounds of the array.
FluffyUnderware.Curvy.CurvySplineSegment.LocalFToDistance (System.Single localF) (at Assets/Michael/Plugins/Curvy/Base/CurvySplineSegment.cs:1397)
FluffyUnderware.Curvy.Controllers.SplineController.MovementCompatibleGetPosition (FluffyUnderware.Curvy.Controllers.SplineController controller, FluffyUnderware.Curvy.CurvyPositionMode positionMode, FluffyUnderware.Curvy.CurvySplineSegment& controlPoint, System.Boolean& isOnControlPoint, System.Single clampedPosition) (at Assets/Michael/Plugins/Curvy/Controllers/SplineController.cs:615)
FluffyUnderware.Curvy.Controllers.SplineController.EventAwareMove (System.Single distance) (at Assets/Michael/Plugins/Curvy/Controllers/SplineController.cs:722)
FluffyUnderware.Curvy.Controllers.SplineController.Advance (System.Single speed, System.Single deltaTime) (at Assets/Michael/Plugins/Curvy/Controllers/SplineController.cs:487)
FluffyUnderware.Curvy.Controllers.CurvyController.InitializedApplyDeltaTime (System.Single deltaTime) (at Assets/Michael/Plugins/Curvy/Controllers/CurvyController.cs:675)
FluffyUnderware.Curvy.Controllers.SplineController.InitializedApplyDeltaTime (System.Single deltaTime) (at Assets/Michael/Plugins/Curvy/Controllers/SplineController.cs:531)
FluffyUnderware.Curvy.Controllers.CurvyController.ApplyDeltaTime (System.Single deltaTime) (at Assets/Michael/Plugins/Curvy/Controllers/CurvyController.cs:1014)
FluffyUnderware.Curvy.Controllers.CurvyController.Update () (at Assets/Michael/Plugins/Curvy/Controllers/CurvyController.cs:605)

ive found that the code is triggered when the splinemode is worldunits, which is weird since all of my splines are in "relative" mode. I will insert this snippet and try again.
Reply
#6
Ok, keep me updated once you have the logs from the snippet.
Do you use connections on your splines?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#7
Hi Aka, 

here is the error print out, seems like the program thinks that the obj is at the end of a spline when its not? And no, for this specific spline where the error comes from, theres no connections, at least to my knowledge. Maybe i should just delete this spline and redraw it? 

Code:
idx  + 1: 201  length 201 ; length 2 201
UnityEngine.Debug:LogError(Object)
FluffyUnderware.Curvy.CurvySplineSegment:LocalFToDistance(Single) (at Assets/Michael/Plugins/Curvy/Base/CurvySplineSegment.cs:1401)
FluffyUnderware.Curvy.Controllers.SplineController:MovementCompatibleGetPosition(SplineController, CurvyPositionMode, CurvySplineSegment&, Boolean&, Single) (at Assets/Michael/Plugins/Curvy/Controllers/SplineController.cs:615)
FluffyUnderware.Curvy.Controllers.SplineController:EventAwareMove(Single) (at Assets/Michael/Plugins/Curvy/Controllers/SplineController.cs:722)
FluffyUnderware.Curvy.Controllers.SplineController:Advance(Single, Single) (at Assets/Michael/Plugins/Curvy/Controllers/SplineController.cs:487)
FluffyUnderware.Curvy.Controllers.CurvyController:InitializedApplyDeltaTime(Single) (at Assets/Michael/Plugins/Curvy/Controllers/CurvyController.cs:675)
FluffyUnderware.Curvy.Controllers.SplineController:InitializedApplyDeltaTime(Single) (at Assets/Michael/Plugins/Curvy/Controllers/SplineController.cs:531)
FluffyUnderware.Curvy.Controllers.CurvyController:ApplyDeltaTime(Single) (at Assets/Michael/Plugins/Curvy/Controllers/CurvyController.cs:1014)
FluffyUnderware.Curvy.Controllers.CurvyController:Update() (at Assets/Michael/Plugins/Curvy/Controllers/CurvyController.cs:605)
Reply
#8
Hmmmm, I really can't see from a quick look what's wrong. I will give this more time once I finish my current task. If you manage to send me a reproduction case, that will be great.
About creating a new spline, since I don't know what's wrong, I can't tell if it will help or not, but you can always try that. But please, before doing so, and if it not asking for too much, keep a copy of the old scene so that you eventually send me a reproduction case
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#9
(03-12-2021, 09:06 AM)_Aka_ Wrote: Hmmmm, I really can't see from a quick look what's wrong. I will give this more time once I finish my current task. If you manage to send me a reproduction case, that will be great.
About creating a new spline, since I don't know what's wrong, I can't tell if it will help or not, but you can always try that. But please, before doing so, and if it not asking for too much, keep a copy of the old scene so that you eventually send me a reproduction case

got it. Ill work on it for 1-2 more days as well and will let you know if i sent you a copy! Thanks so much so far.
Reply
#10
(03-12-2021, 09:06 AM)_Aka_ Wrote: Hmmmm, I really can't see from a quick look what's wrong. I will give this more time once I finish my current task. If you manage to send me a reproduction case, that will be great.
About creating a new spline, since I don't know what's wrong, I can't tell if it will help or not, but you can always try that. But please, before doing so, and if it not asking for too much, keep a copy of the old scene so that you eventually send me a reproduction case

one more update: i have created a new spline and deleted the old one, and it seems like the error persists. However, something i have found is that the error always shows at a specific control point. The current spline is set up in a U shape and the error always shows at the second control point:
[Image: mzQr32N] (https://ibb.co/mzQr32N)

another clue ive found is that as you can see, I have two splines in this scene (in fact i have 4, but hid the other two to avoid confusion), and this error seems to only pop up when all four splines are active in the scene. When i disable the other splines, the error seems to disappear. Maybe theres some secret connection in between splines im not aware of?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding function to set GameObjecs in InputGameObject.cs Mos Def 2 111 04-01-2021, 03:43 PM
Last Post: Mos Def
  Merge function for two CurvySplines HatraE 4 382 01-29-2021, 12:51 PM
Last Post: HatraE
  IndexOutOfRangeException In InterpolateFast UsernameHed 7 3,649 09-06-2019, 09:44 PM
Last Post: _Aka_
  Some Questions about useful function I need UsernameHed 5 3,435 05-06-2019, 02:22 PM
Last Post: _Aka_

Forum Jump: