//=================== line renderer private void UpdateLineRenderer() { const int count = 100; var positions = new Vector3[100]; const float countMinusOne = count - 1; for (var i = 0; i < 100; i++) { var distanceRatio = i / countMinusOne; positions[i] = Math.CalcByDistanceRatio(BGCurveBaseMath.Field.Position, distanceRatio); } lineRenderer.SetVertexCount(count); lineRenderer.SetPositions(positions); }
//=================== line renderer private void UpdateLineRenderer() { const int count = 100; var positions = new Vector3[100]; const float countMinusOne = count - 1; for (var i = 0; i < 100; i++) { var distanceRatio = i / countMinusOne; positions[i] = Math.CalcByDistanceRatio(BGCurveBaseMath.Field.Position, distanceRatio); } #if UNITY_5_5 lineRenderer.numPositions = count; #elif UNITY_5_6_OR_NEWER lineRenderer.positionCount = count; #else lineRenderer.SetVertexCount(count); #endif lineRenderer.SetPositions(positions); }