Example #1
0
    private void OnSceneGUI()
    {
        List <Vector3> positions = platform.GetPositions();

        Handles.color = Color.magenta;

        if (positions == null || positions.Count == 0)
        {
            return;
        }

        Vector3[] lineSegments = new Vector3[positions.Count * 2];
        Vector3   prevPoint    = positions[positions.Count - 1];

        int pointIndex = 0;

        for (int posInd = 0; posInd < positions.Count; posInd++)
        {
            Vector3 currPoint = positions[posInd];

            // store the starting point of the line segment
            lineSegments[pointIndex] = platformTransform.localPosition + prevPoint;
            pointIndex++;

            // store the ending point of the line segment
            lineSegments[pointIndex] = platformTransform.localPosition + currPoint;
            pointIndex++;

            prevPoint = currPoint;
        }
        Handles.DrawLines(lineSegments);
    }