I’m trying to do pathEditor, each path node is ScriptableObject
[System.Serializable]
public class TGPathNode: ScriptableObject {
public TGPathBezierMode BezierMode;
public TGPathNodeMode Mode;
public List<TGPathNode> Links = new List<TGPathNode>();
public Vector3[] Points = new Vector3[3];
}
Nodes stores in MonoBehaviour script like this
public List<TGPathNode> PathNodes = new List<TGPathNode>();
In Editor i need Undo support for add delete pathnode, please help me to do it
This code no effect after Undo command:
// Make sure that the list is serialized
[SerializeField]
public List<TGPathNode> PathNodes = new List<TGPathNode>();
Undo.RecordObject(_target,"DeleteNode");
Undo.DestroyImmediate(_target.PathNodes[0]);
EditorUtility.SetDirty(_target);