Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
StackOverflowException on large spline network
#4
Hi Roger

I have 2484 connections to be precise. I'm actually not sure if my stack overflow issue is specific to Curvy or Unity itself. I first tried adding a custom connection component to each CurvySplineSegment (i.e. control point), but the result here was the same with the scene playing fine in the editor but causing a StackOverflowException when building.

I have now resorted to creating a dictionary on scene load with an entry for each control point in the scene. For each control point in the dictionary I have a simple wrapper class holding references to control points that should connect to this control point. I use the InstanceID of each control point to perform a fast lookup in the dictionary whenever I reach a control point, and this is working well for me so far.

I'm not exactly sure what you mean by "permanently enabled animation feature", but because I have so many splines in the scene I was having performance issues from the CPU overhead of all the splines having their update methods invoked each frame. Since all splines in my scene are static this overhead is not necessary.

To remove the update calls I've wrapped the three update methods in CurvySpline.cs in a conditional define so that they are only run in the Unity editor (i.e. #if UNITY_EDITOR). On scene load I then manually call update on each spline a single time to initialize them which allows the SplineController to navigate the spline network.

If the Curvy authors are reading this, It would be nice with official support for this last step of eliminating the update calls for static splines, to avoid having to implement the workaround whenever the package is updated Smile

Best regards
Christian
Reply


Messages In This Thread
RE: StackOverflowException on large spline network - by Nalle - 03-17-2016, 01:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  GO can't fit end of the spline GameDeveloperek4123 3 14 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: