Hey,
I have a few moving gameobjects and want to draw a line between them.
private void LateUpdate()
{
UpdateRoute();
}
public void UpdateRoute()
{
lineRenderer.positionCount = movingGameObjectList.Count;
for(int i = 0; i < movingGameObjectList.Count; i++)
{
lineRenderer.SetPosition(i, movingGameObjectList*.transform.position);*
}
}
This works fine until I start to move the objects and the LineRenderer appears to lag behind a frame for some reason.
LineRenderer.UseWorldSpace is interchangable for me and does not solve the problem.
Calling the UpdateRoute() function in LateUpdate or Update apparently does not matter.
Compiling the position data into a Vector3 array and using LineRenderer.SetPositions(); does not do anything as well.
A few weeks ago I stumbled over a small forum post that said, restarting Unity solved the problem for him. And it did for me as well but now the bug is backā¦
and the lineRenderer is lagging even in a built version of the project.
Any idea what I can do?
Are there alternatives to the Unity LineRenderer that is not GL.Lines ?