// Remove a link to a given node/inlet. public void RemoveLink(Outlet outlet, Node targetNode, Inlet inlet) { Undo.RecordObject(_instance, "Remove Link"); // Retrieve the target method (inlet) information. var targetMethod = targetNode._instance.GetType().GetMethod(inlet.methodName); // Remove the link. LinkUtility.RemoveLinkNodes( _instance, outlet.boundEvent, targetNode._instance, targetMethod ); // Clear the cache and update information. _cachedLinks = null; _serializedObject.Update(); }
// Try to make a link from the outlet to a given node/inlet. public void TryLinkTo(Outlet outlet, Node targetNode, Inlet inlet) { Undo.RecordObject(_instance, "Link To Node"); // Retrieve the target method (inlet) information. var targetMethod = targetNode._instance.GetType().GetMethod(inlet.methodName); // Try to create a link. var result = LinkUtility.TryLinkNodes( _instance, outlet.boundEvent, targetNode._instance, targetMethod ); // Clear the cache and update information. if (result) { _cachedLinks = null; _serializedObject.Update(); } }