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
  Getting Distance from a World Point zorksox 3 5 04-16-2024, 07:30 PM
Last Post: _Aka_
  Set Volume to the Volume Controller at Runtime pako88 2 10 04-08-2024, 03:26 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_
  How could I get position in spline from "From" value in BuildRasterizedPath? Chanon 1 8 02-12-2024, 09:54 PM
Last Post: _Aka_

Forum Jump: