Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic CurvySpline and memory allocation
#5
Hi Jake, 

Did a quick test in Unity 5 beta13. 
I am doing a few things wrong in the test code.
1. Adding one Vector3 at a time to CurvySpline (which triggers 1xRefreshImmediately() per add)
2. I have not included the code to update the Up vector of the control points.
3. FollowSpline doesn't starts from the beginning when new controlpoints are added. (Don't know how to do that yet).

Anyway, with the test code, whenever you mouseUp:
1. CurvySpline.Clear()
2. Individually adding (or remove) a Vector3 (between 4~20 control points)
3. Then GameObject with FollowSpline will travel there.


Looking at U5 profiler (first time), the spike in the CPU usage is when I mouseUp (probably when I'm calling multiple RefreshImmediate() per frame).
I'm not worry about the CPU utilisation at this stage, but it give you a good indicator to memory allocation in the Memory usage graph below.
The total Total memory increases a bit whenever i do a mouseUp.
If I let the code run a bit more (not shown here), the Total Allocated (Memory) drops even without GC.  It's kind of weird. 
Anyway, I don't know enough to be able to draw any conclusion.  But I know memory usage does increase whenever I dynamically add CPs to the spline I can't say how much of this will cause an issue for my game (and especially on mobile platform), so I'm going to park this aside, until I progress other parts of the game.

I have send you a copy of the test code to (info@fluffy...), if you have time to look into it.

BTW, do you have any good suggestion how I can add a list of position and Up-vector to CurvySpline?
Using CurvyLineSegement via CurvySpline.Add(CurvySpline Segment, bool)?


kimc.
[Image: qrFIAQO.png?1]
 

 

 
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: