Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Avoiding runtime GC allocations on control point position change
#1
Hello,

Loving the tool so far, but I am wondering if there is a way to avoid GC allocations on control point position changes at runtime?

I am trying to match a spline with 'anchors' I have on a moving object and currently using the following code in update:
Code:
controlPoints ??= wormRail.ControlPointsList;

for (int i = 0; i < anchors.Count; i++)
{
    controlPoints[i].SetPosition(anchors[i].transform.position);
}

But this is incurring ~1.2KB GC each frame (8 control points). Is there a way to update spline control points at runtime without GC allocations?

Thanks,
Elliott
Reply


Messages In This Thread
Avoiding runtime GC allocations on control point position change - by Ell223 - 02-04-2024, 12:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Control Point Interpolation Overrides. rickgplus 1 529 12-11-2025, 08:52 AM
Last Post: _Aka_
  Is there a way to get the position of each ControlPoint in spline by API? Chanon 1 2,134 06-07-2025, 09:44 AM
Last Post: _Aka_
  12_Train junction point richardzzzarnold 5 3,413 04-16-2025, 02:19 PM
Last Post: _Aka_
  OnAfterControlPointAdded - Control Point is null jh092 5 3,191 02-04-2025, 09:31 PM
Last Post: _Aka_

Forum Jump: