Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic CurvySpline and memory allocation
#2
Have you profiled this with Unity 4.6 (or 5 Beta) to be sure this is still a problem? UT said they greatly improved performance on this. I'll run some tests with 5.0 by myself and probably add pooling if this still is an issue.

Otherwise, pre-generating them and enabling them on demand is an option, but to be honest I doubt that the current version can handle this properly because the spline sorts it's CPs by hierarchy order (I changed this for 2.0).

Also, without having it profiled I would guess that the recalculation the spline does when adding CPs eats more time than instantiating a GameObject. Though you can add multiple points in a row and then refresh the spline once.

Another idea that you might want to consider: What about pregenerate a spline with 20 CPs and set all "unused" CPs to the same position as the last "enabled" one? Or, probably even easier, ignore them completely and only use (render, travel etc..) the range you want (say from TF=0 to TF=0.5, if you have 10 of 20 CPs in use)

Let me know if that helps, otherwise I'll add pooling to the current 2.0 dev version and give you access to it.

Jake
Reply


Messages In This Thread

Possibly Related Threads…
Thread Author Replies Views Last Post
  Disable rebuild of meshes in dynamic mode Zilk1 1 8 10-04-2023, 09:50 AM
Last Post: _Aka_
  I have a question about curvySpline haifeng.huang 12 32 07-14-2023, 09:34 AM
Last Post: _Aka_
  "Deadloop in CurvySPline.Refresh" spam Valkymaera 3 11 05-30-2023, 10:56 AM
Last Post: _Aka_
  Is curvyspline a good solution for a 2D rail grinding game? bazz_boyy1 2 8 03-01-2022, 11:49 AM
Last Post: _Aka_

Forum Jump: