Visual representation of waypoints

Hello,

Just wanted to put this out there for anyone who wanted a visualization of your waypoints!

Put this script on your parent path object.

This will draw a line between the waypoints and also label them based on the name. I just duplicate the last one so it keeps a nice sequential order to the names.

I found it makes tuning the waves way easier.

Cheers,

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class DrawPath : MonoBehaviour
{
    [SerializeField] float sphereSize = 0.2f;

    private void OnDrawGizmos()
    {
        Transform lastChild = null;
        foreach(Transform child in transform)
        {

            Handles.Label(child.transform.position, child.transform.gameObject.name);
            Gizmos.color = Color.green;
            Gizmos.DrawSphere(child.transform.position, sphereSize);
            if (lastChild != null)
            {
                Gizmos.color = Color.red;
                Gizmos.DrawLine(child.position, lastChild.position);

            }
            lastChild = child;
        }
    }
}
3 Likes

Privacy & Terms