示例#1
0
    void OnSceneGUI()
    {
        ConnectedObjects connectedObjects = target as ConnectedObjects;

        if (connectedObjects == null)
        {
            return;
        }
        Waypoint[] waypoints = connectedObjects.GetComponentsInChildren <Waypoint>();
        if (waypoints.Length <= 0)
        {
            return;
        }


        for (int i = 1; i < waypoints.Length; i++)
        {
            Vector3 firstLocation = waypoints[i - 1].Position;
            Vector3 lastLocation  = waypoints[i].Position;

            Handles.DrawLine(firstLocation, lastLocation);
        }
    }
    void OnSceneGUI()
    {
        ConnectedObjects connectedObjects = target as ConnectedObjects;

        if (connectedObjects == null)
        {
            return;
        }
        Transform[] transforms = connectedObjects.GetComponentsInChildren <Transform>();
        if (transforms.Length <= 0)
        {
            return;
        }


        for (int i = 2; i < transforms.Length; i++)
        {
            Vector3 firstLocation = transforms[i - 1].position;
            Vector3 lastLocation  = transforms[i].position;

            Handles.color = Color.red;
            Handles.DrawLine(firstLocation, lastLocation);
        }
    }