public void RemoveVariable(NodeGraphVariable variable)
 {
     variables.Remove(variable);
     foreach (var node in nodes)
     {
         node.VariableRemoved(variable);
     }
 }
 public void RemoveRuleWithVariable(NodeGraphVariable variable)
 {
     for (int i = rules.Count - 1; i > -1; i++)
     {
         if (rules[i].Variable == variable)
         {
             var rule = rules[i];
             rules.RemoveAt(i);
             UnityEngine.Object.DestroyImmediate(rule, true);
         }
     }
 }
 public virtual void VariableRemoved(NodeGraphVariable variable)
 {
     foreach (var port in Outputs)
     {
         foreach (var connection in port.Connections)
         {
             for (int i = connection.rules.Count - 1; i > -1; i--)
             {
                 var rule = connection.rules[i];
                 if (rule.Variable == variable)
                 {
                     connection.rules.Remove(rule);
                     DestroyImmediate(rule, true);
                 }
             }
         }
     }
     graph.IsDirty = true;
 }