private void NewNodeCallback(Node node) { if (m_ReplaceNode != null) { for (int index = 0; index < m_ReplaceNode.Inputs.Count; index++) { var oldInput = m_ReplaceNode.Inputs[index]; if (oldInput.connection != null) { for (int indexNewNodesInputs = 0; indexNewNodesInputs < node.Inputs.Count; indexNewNodesInputs++) { var newInput = node.Inputs[indexNewNodesInputs]; if (newInput.connection == null && newInput.typeID == oldInput.typeID) { newInput.ApplyConnection(oldInput.connection); //newInput.connection = oldInput.connection; break; } } } } for (int index = 0; index < m_ReplaceNode.Outputs.Count; index++) { var oldOutput = m_ReplaceNode.Outputs[index]; if (oldOutput.connections != null) { for (int indexNewNodesOutputs = 0; indexNewNodesOutputs < node.Outputs.Count; indexNewNodesOutputs++) { var newOutput = node.Outputs[indexNewNodesOutputs]; if (newOutput.typeID == oldOutput.typeID) { for (int i = oldOutput.connections.Count - 1; i >= 0; i--) { var x = oldOutput.connections[i]; x.ApplyConnection(newOutput); //newOutput.connections = oldOutput.connections; } break; } } } } node.rect = m_ReplaceNode.rect; m_ReplaceNode.Delete(); m_ReplaceNode = null; NodeEditor.RecalculateFrom(node); } }