MD Package Technical & APi Documentation
MDG_PathCreator
Namespace: MDPackage.Geometry
Complete 'path' creation solution with node-based editor in Unity Engine in editor & at runtime. Apply this script to any gameObject with meshFilter.
Read more here (Online documentation slide)
Public Methods
// Add node on specific position
public void Path_AddNode(Vector3 positionInWorldSpace, bool groupTogetherOnAdd = true)
// Remove last node
public void Path_RemoveLastNode()
// Destroy & Clear all nodes
public void Path_RemoveAll()
// Refresh current path mesh
public void Path_RefreshNodes()
// Group all nodes together in hierarchy
public void Path_GroupAllNodesTogether()
// Ungroup all nodes to 'empty' or to 'some object'
public void Path_UngroupAllNodes(Transform detachToOtherParent = null)
// Update UV sets list
public void Path_UpdateUVs()

public static void CreateGeometry()
Public Fields and Properties
public float pathSize = 1.0f;
public float pathNodeSize = 0.2f;

public bool pathApplyWorldUvs = true;
public bool pathReverseFaces = false;
public bool pathApplyNodeLocalScale = false;

public bool pathUpdateEveryFrame = true;
public bool pathUseSmartRotation = true; // Nodes will rotate towards each other in order

public bool pathEnableGizmos = true;

public List<Transform> PathCurrentNodes { get; }
Examples
The following paragraphs contain Path Creator used in a practical example. Create a path creator behaviour at runtime and add custom path nodes.
using UnityEngine;
using MDPackage.Geometry;

public class SampleScript : MonoBehaviour
{
private MDG_PathCreator pathCreator;
private Vector3 currentNodePos;

private void Start()
 {
  // Create a new path creator on startup
  pathCreator = gameObject.AddComponent<MDG_PathCreator>();
  pathCreator.transform.position = Vector3.zero;
 }

private void Update()
 {
  // Create path nodes on the specific direction
  // use WASD to add path nodes
  if (Input.GetKeyDown(KeyCode.W))
   AddNode(Vector3.forward);
  if (Input.GetKeyDown(KeyCode.D))
   AddNode(Vector3.right);
  if (Input.GetKeyDown(KeyCode.S))
   AddNode(Vector3.back);
  if (Input.GetKeyDown(KeyCode.A))
   AddNode(Vector3.left);

  // Local method
  void AddNode(Vector3 pos)
  {
   currentNodePos += pos;
   pathCreator.Path_AddNode(currentNodePos);
  }
 }
}