Draw line on play gets distorted

Hi everyone,

Here is the problem, check the screenshots:
[79780-editor.png*|79780]
and [79781-playmode.png*|79781]
So this happens after I enter the play mode.
What is it all about? I have made a custom spline editor for path finding, everything works well except this visual issue. Everything is drawn in the OnDrawGizmos().

Here is a piece of code I use to draw all the elements:

for (int i = 0; i < BezierCoordinates.Length; i++)
	{
		t = i * fraction;

		p0pos = Point0.Position;
		p1pos = Point1.Position;
		p2pos = Point2.Position;
		pointCoords = ((1 - t) * (1 - t)) * p0pos + 2 * (1 - t) * t * p1pos + t * t * p2pos;

		BezierCoordinates *= pointCoords;*
  •  if (i != BezierCoordinates.Length - 1)*
    
  •  {*
    
  •  	Gizmos.color = PathLineColor;*
    

_ Gizmos.DrawLine(BezierCoordinates*, BezierCoordinates[i + 1]);_
_
}*_

* if(drawSteps)*
* {*
* Gizmos.color = PathPointsColor;*
_ Gizmos.DrawWireSphere(BezierCoordinates*, PathPointsSize);
}*_

* Gizmos.color = PathLineColor;*
* Gizmos.DrawLine(BezierCoordinates[BezierCoordinates.Length - 1], p2pos);*
}
Any suggestions? Hope to hear from someone!
And thanks in advance.
*
*

This was happening because I had another method which did the same as the one above. I was updating points in two places, in Update loop and OnDrawGizmos, this was the issue. Now it’s only in OnDrawGizmos and now it works fine.