public NodePanel Clone(BehaviourTree tree, CanvasState state) { NodePanel clone = hasOuthandle ? new NodePanel(tree.GetNode(nodeGuid), transform.rect, inHandle.transform.rect, outHandle.transform.rect, state) : new NodePanel(tree.GetNode(nodeGuid), transform.rect, inHandle.transform.rect, state); clone.guid = guid; clone.childrenGuids = childrenGuids; clone.parentGuid = parentGuid; clone.transform = transform.Clone(state); clone.icon = icon; clone.inHandle = inHandle.Clone(state); clone.hasOuthandle = hasOuthandle; if (hasOuthandle) { clone.outHandle = outHandle.Clone(state); } return(clone); }