Search Unity

Custom Editor for waypoint system with branches

Discussion in 'Immediate Mode GUI (IMGUI)' started by EugenEistrach, Oct 5, 2015.

  1. EugenEistrach

    EugenEistrach

    Joined:
    Jun 3, 2015
    Posts:
    8
    Hey, Im trying to script a custom editor for a waypoint system.
    I want the waypoint system to work like this: I have a node, the node has a starting position and a list of possible branches. The branches are again all nodes. So this is how it would look very simple:
    Code (csharp):
    1.  
    2. public class PathManager : MonoBehaviour {
    3.  
    4.     public Node[] paths;
    5.  
    6.     [System.Serializable]
    7.     public class Node
    8.     {
    9.         public Vector3 position;
    10.         public Node[] branches;
    11.     }
    12. }
    13.  
    This will cause a depth error in the unity editor because I use a list of nodes in the node class.
    I want to build something very simple with handles. To connect nodes and let them branch off directly in the editor.
    Can somebody point me in a direction on how to solve my problem?

    Thanks